Skip to content

Avoid invalid UTF-8 characters breaking json_encode by applying JSON_INVALID_UTF8_SUBSTITUTE flag (#15796) #16025

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

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

Mark-H
Copy link
Collaborator

@Mark-H Mark-H commented Feb 2, 2022

What does it do?

Add the JSON_INVALID_UTF8_SUBSTITUTE flag to any json_encode usage in the core that may contain user-defined content that could through some issue contain invalid UTF-8 characters.

The most important change is in the Processor class, which basically applies the fix to any standard processor.

Why is it needed?

When encountering invalid characters, rather than breaking entirely, substitute the invalid characters with the boxed question mark. Avoids manager-breaking javascript errors.

How to test

Ensure changed processors/controllers continue to work as expected. Make sure I didn't accidentally put a comma in the wrong place.

Related issue(s)/PR(s)

Fixes #15796

@Mark-H Mark-H requested a review from opengeek as a code owner February 2, 2022 12:21
@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Feb 2, 2022
@Mark-H Mark-H added this to the v3.0.0-rc2 milestone Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed CLA confirmed for contributors to this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants