Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid json (with latin1 chars) get parsed instead of throwing an exception #52

Open
dominikzogg opened this issue Jun 13, 2018 · 5 comments

Comments

@dominikzogg
Copy link

I've tried to enhance error handling of my deserializer library (https://github.com/chubbyphp/chubbyphp-deserialization/blob/master/src/Decoder/JsonTypeDecoder.php) and wished to support native json_decode and your library (what the library user prefers).

While testing i've seen, that the parser seems to allow latin1 chars within the json.
What i know, json needs to be utf-8 (or asci).

@dominikzogg
Copy link
Author

@Seldaek
Copy link
Owner

Seldaek commented Jul 20, 2018

Interesting.. Not sure how we could fix this though, if you have a suggestion feel free.

@staabm
Copy link
Contributor

staabm commented Jul 20, 2018

so the question is: should the linter check the whole file for non-utf8 characters, right?

@Seldaek
Copy link
Owner

Seldaek commented Jul 20, 2018

I guess it should reject any invalid utf8 char yes.

@dominikzogg
Copy link
Author

@Seldaek a check having at least two chars > 127 instead of one would probably fix most, but it would be still possible having 'ää' as latin1 which seems to be utf-8 then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants