1
0
mirror of https://github.com/halaxa/json-machine.git synced 2025-03-15 17:09:39 +01:00

Merge pull request #42 from halaxa/fix-41

Incomplete JSON buffer after composite value containing an empty dict fixed
This commit is contained in:
Filip Halaxa 2021-04-06 11:40:13 +02:00 committed by GitHub
commit 6bc53a05e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -194,6 +194,7 @@ class Parser implements \IteratorAggregate, PositionAware
$expectedType = 55; // 55 = self::AFTER_ARRAY_START;
continue 2; // valid json chunk is not completed yet
case '}':
$objectKeyExpected = false;
case ']':
--$currentLevel;
$inObject = $stack[$currentLevel] === '{';

View File

@ -56,6 +56,7 @@ class ParserTest extends \PHPUnit_Framework_TestCase
['/0/0', '[{"0":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]],
['/1/1', '[0,{"1":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]],
'PR-19-FIX' => ['/datafeed/programs/1', file_get_contents(__DIR__.'/PR-19-FIX.json'), ['program_info'=>['id'=>'X1']]],
'ISSUE-41-FIX' => ['/path', '{"path":[{"empty":{}},{"value":1}]}', [["empty"=>[]],["value"=>1]]],
];
}