Skip to content

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

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
ar2r:bugfix/json-unescaped-error-messages
Oct 4, 2022
Merged

[9.x] Testing methods. Making error messages with json_encode more readable#44397
taylorotwell merged 3 commits into
laravel:9.xfrom
ar2r:bugfix/json-unescaped-error-messages

Conversation

@ar2r

@ar2r ar2r commented Sep 30, 2022

Copy link
Copy Markdown
Contributor

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