JSON substitution and ignoring invalid UTF-8 characters#2606
Closed
bukka wants to merge 8 commits intophp:masterfrom
Closed
JSON substitution and ignoring invalid UTF-8 characters#2606bukka wants to merge 8 commits intophp:masterfrom
bukka wants to merge 8 commits intophp:masterfrom
Conversation
Member
Author
|
The patch is ready for merge and will be merging that in the next couple of days if there are no objections |
Member
Author
|
Merged via 0d0f7cd |
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.
This PR introduces 2 new constant to the JSON extension:
Both options can be used in
json_encodeas well asjson_decodeand their purpose is to either ignore or replace invalid UTF-8 character with0xfffd( Unicode Character 'REPLACEMENT CHARACTER' ). There is no BC concern as the default stays the same.It addresses https://bugs.php.net/bug.php?id=65082 . @remicollet you might be interested in this as you initially had it assigned and I took some inspiration for the encoding test and a little bit of logic in encoder. Decoder is completely new ofc.
The PR needs couple of more tests and possibly some small fixes but the core of it should stay as it is. I would like to merge it to 7.2 if there are no concerns from RM's or others.