diff --git a/docs/01-getting-started.md b/docs/01-getting-started.md index 00fb0e9f..91fa9bd2 100644 --- a/docs/01-getting-started.md +++ b/docs/01-getting-started.md @@ -42,7 +42,7 @@ A full basic example looks like this: load(); $me = $foaf->primaryTopic(); echo "My name is: ".$me->get('foaf:name')."\n"; diff --git a/examples/foafinfo.php b/examples/foafinfo.php index 5e1538bf..c231d67d 100644 --- a/examples/foafinfo.php +++ b/examples/foafinfo.php @@ -22,7 +22,7 @@
Name: get('http://example.com/joe', 'foaf:name'); ?>
Names: join('http://example.com/joe', 'foaf:name'); ?>
- Label: label('http://njh.me/'); ?>
+ Label: label('https://www.aelius.com/njh/'); ?>
Properties: properties('http://example.com/joe')); ?>
PropertyUris: propertyUris('http://example.com/joe')); ?>
People: allOfType('foaf:Person')); ?>
diff --git a/lib/Literal.php b/lib/Literal.php
index e53c1a42..848968f9 100644
--- a/lib/Literal.php
+++ b/lib/Literal.php
@@ -107,7 +107,7 @@ public static function create($value, $lang = null, $datatype = null)
}
// Work out what class to use for this datatype
- if (isset(self::$datatypeMap[$datatype])) {
+ if (is_string($datatype) && isset(self::$datatypeMap[$datatype])) {
$class = self::$datatypeMap[$datatype];
} else {
$class = 'EasyRdf\Literal';
diff --git a/lib/Parser/RdfXml.php b/lib/Parser/RdfXml.php
index e8f3422c..c11e1a96 100644
--- a/lib/Parser/RdfXml.php
+++ b/lib/Parser/RdfXml.php
@@ -813,8 +813,6 @@ public function parse($graph, $data, $format, $baseUri)
}
}
- xml_parser_free($this->xmlParser);
-
return $this->tripleCount;
}
}
diff --git a/lib/Parser/Turtle.php b/lib/Parser/Turtle.php
index ad414edd..5cb9e917 100644
--- a/lib/Parser/Turtle.php
+++ b/lib/Parser/Turtle.php
@@ -1195,11 +1195,15 @@ public static function isWhitespace($c)
return "\x20" == $c || "\x09" == $c || "\x0A" == $c || "\x0D" == $c;
}
- /** @ignore */
+ /**
+ * @param non-empty-string $c
+ *
+ * @ignore
+ */
public static function isPrefixStartChar($c)
{
// ord - Convert the first byte of a string to a value between 0 and 255
- $o = \ord($c);
+ $o = \ord($c[0]);
return
$o >= 0x41 && $o <= 0x5A // A-Z
@@ -1220,11 +1224,15 @@ public static function isNameStartChar($c)
|| self::isPrefixStartChar($c);
}
- /** @ignore */
+ /**
+ * @param non-empty-string $c
+ *
+ * @ignore
+ */
public static function isNameChar($c)
{
// ord - Convert the first byte of a string to a value between 0 and 255
- $o = \ord($c);
+ $o = \ord($c[0]);
return
self::isNameStartChar($c)
diff --git a/tests/EasyRdf/Sparql/ResultTest.php b/tests/EasyRdf/Sparql/ResultTest.php
index bceb4fa1..ad6f9e6c 100644
--- a/tests/EasyRdf/Sparql/ResultTest.php
+++ b/tests/EasyRdf/Sparql/ResultTest.php
@@ -459,7 +459,12 @@ public function testDumpUnknownType()
'ReflectionProperty::setAccessible() is not available.'
);
} else {
- $reflector->setAccessible(true);
+ // TODO: remove this if-clause when dropping 8.0.x support
+ // From documentation > http://php.net/manual/en/reflectionproperty.setaccessible.php:
+ // As of PHP 8.1.0, calling this method has no effect; all properties are accessible by default.
+ if (version_compare(PHP_VERSION, '8.1.0', '<')) {
+ $reflector->setAccessible(true);
+ }
}
$reflector->setValue($result, 'foobar');
diff --git a/tests/ExampleTest/FoafinfoTest.php b/tests/ExampleTest/FoafinfoTest.php
index 7b7e0f90..ac1ec3e4 100644
--- a/tests/ExampleTest/FoafinfoTest.php
+++ b/tests/ExampleTest/FoafinfoTest.php
@@ -45,31 +45,8 @@ public function testNoParams()
$this->assertStringContainsString('