Fix JsonPointer::remove() not handling sequential arrays correctly#67
Merged
vearutop merged 2 commits intoswaggest:masterfrom Nov 17, 2023
Merged
Fix JsonPointer::remove() not handling sequential arrays correctly#67vearutop merged 2 commits intoswaggest:masterfrom
JsonPointer::remove() not handling sequential arrays correctly#67vearutop merged 2 commits intoswaggest:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #67 +/- ##
=======================================
Coverage 96.95% 96.96%
=======================================
Files 15 15
Lines 592 593 +1
=======================================
+ Hits 574 575 +1
Misses 18 18
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Contributor
Author
|
Hey @vearutop, any chance you're able to find some time to merge this PR? We would love to get the fix pushed out to production as soon as possible. Thanks |
Member
|
Ah, sorry this took me so long. Thank you for you contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
JsonPointer::remove()method doesn't correctly detect sequential vs associative arrays when theTOLERATE_ASSOCIATIVE_ARRAYSis enabled. This causes most sequential arrays to be converted to associative arrays.The issue is due to the
$icounter not being incremented in theforeachloop that detects whether an array is sequential or associative.While the counter can be incremented in the
ifstatement, like in #65, I've decided to do it in the body of theforeachloop as I believe it to be less "clever" and easier to read. I have also added a test to prove the issue and defend against it in the future.