Closed Branlute closed 11 months ago
We've just stumbled across this as well and came up with a similar fix. Would love to see this merged soon. Pinging @vearutop for visibility.
I decided to create #67 which includes a test case and increments the counter in the body of the foreach
loop as I believe that to be easier to read.
Hello,
For a patch which remove elements to non associative array, we need to reindex this array. This line is good https://github.com/swaggest/json-diff/blob/f4e511708060ff7511a3743fab4aa484a062bcfb/src/JsonPointer.php#L297 But the condition for $isAssociative has an issue.
We need to increment $i to compare with $index, otherwise $i will always be equal to 0 for all iterations.