diff --git a/src/main/php/text/json/Input.class.php b/src/main/php/text/json/Input.class.php index 763bf0d..492f4f4 100755 --- a/src/main/php/text/json/Input.class.php +++ b/src/main/php/text/json/Input.class.php @@ -92,7 +92,7 @@ protected function escaped($pos, $len, &$offset) { protected function readObject($nesting) { $token= $this->nextToken(); if ('}' === $token) { - return []; + return (object)[]; } else if (null !== $token) { $result= []; if (++$nesting > $this->maximumNesting) { diff --git a/src/test/php/text/json/unittest/JsonInputTest.class.php b/src/test/php/text/json/unittest/JsonInputTest.class.php index 1a82743..073c144 100755 --- a/src/test/php/text/json/unittest/JsonInputTest.class.php +++ b/src/test/php/text/json/unittest/JsonInputTest.class.php @@ -118,7 +118,7 @@ public function read_keyword($expected, $source) { #[Test, Values(['{}', '{ }'])] public function read_empty_object($source) { - Assert::equals([], $this->read($source)); + Assert::equals((object)[], $this->read($source)); } #[Test, Values(['{"key": "value"}', '{"key" : "value"}', '{ "key" : "value" }'])]