Skip to content

Commit

Permalink
Fixed #110
Browse files Browse the repository at this point in the history
  • Loading branch information
halaxa committed Nov 3, 2024
1 parent e36ac09 commit 775f216
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<br>

## master
Nothing yet
### Fixed
- Wrong key when combining list and scalar value pointers (#110). Thanks [@daniel-sc](https://github.com/daniel-sc)

<br>

Expand Down
1 change: 1 addition & 0 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function getIterator()
$currentPathChanged = false;
$jsonPointerPath = $this->getMatchingJsonPointerPath();
$iteratorLevel = count($jsonPointerPath);
$iteratorStruct = null;
}
$tokenType = $tokenTypes[$token[0]];
if (0 == ($tokenType & $expectedType)) {
Expand Down
30 changes: 30 additions & 0 deletions test/JsonMachineTest/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,36 @@ public function data_testSyntax()
['id' => '2'],
],
],
'ISSUE-110-vector-first' => [
['/items', '/total'],
'{
"items": [
["test1"],
["test2"]
],
"total": 2
}',
[
[0 => ['test1']],
[1 => ['test2']],
['total' => 2],
],
],
'ISSUE-110-scalar-first' => [
['/items', '/total'],
'{
"total": 2,
"items": [
["test1"],
["test2"]
]
}',
[
['total' => 2],
[0 => ['test1']],
[1 => ['test2']],
],
],
];
}

Expand Down

0 comments on commit 775f216

Please sign in to comment.