Skip to content

Comments

[12.x] Handle binary data in Js::encode() debug renderer#58618

Merged
taylorotwell merged 1 commit intolaravel:12.xfrom
denis-chmel:js-encode-fix-malformed-utf8
Feb 4, 2026
Merged

[12.x] Handle binary data in Js::encode() debug renderer#58618
taylorotwell merged 1 commit intolaravel:12.xfrom
denis-chmel:js-encode-fix-malformed-utf8

Conversation

@denis-chmel
Copy link
Contributor

Add JSON_INVALID_UTF8_SUBSTITUTE flag to prevent JsonException when encoding binary data (e.g., gzipped strings) in debug mode.

Before: Js::encode(gzencode('test')) throws "Malformed UTF-8"
After: Js::encode(gzencode('test')) encodes with � placeholders

This prevents the debug renderer from masking actual exceptions when query logs or context contain binary data.

Add JSON_INVALID_UTF8_SUBSTITUTE flag to prevent JsonException when encoding
binary data (e.g., gzipped strings) in debug mode.

Before: Js::encode(gzencode('test')) throws "Malformed UTF-8"
After:  Js::encode(gzencode('test')) encodes with � placeholders

This prevents the debug renderer from masking actual exceptions when query
logs or context contain binary data.
@taylorotwell taylorotwell merged commit 1e516f4 into laravel:12.x Feb 4, 2026
72 checks passed
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