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

[9.x] Testing methods. Making error messages with json_encode more readable #44397

Merged
merged 3 commits into from
Oct 4, 2022

Conversation

ar2r
Copy link
Contributor

@ar2r ar2r commented Sep 30, 2022

Added JSON_UNESCAPED_UNICODE in json_encode to make error messages more readable.

Before patching, error messages looks like this (look at Unicode \u0000):

Failed asserting that exception message 'Unable to find JSON fragment: 

[{"id":1}]

within

[[{"foo":"bar","id":10},{"foo":"\u041c\u0438\u0440","id":30},{"foo":"\u041f\u0440\u0438\u0432\u0435\u0442","id":20}]].

After patching, error messages become more readable:

Failed asserting that exception message 'Unable to find JSON fragment: 

[{"id":1}]

within

[[{"foo":"bar","id":10},{"foo":"Мир","id":30},{"foo":"Привет","id":20}]].

This feature allows reading Unicode text without converting it in external tools or sites.

PS: I removed redundant spaces.

@taylorotwell taylorotwell merged commit 58a6770 into laravel:9.x Oct 4, 2022
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

Successfully merging this pull request may close these issues.

2 participants