Skip to content

[6.x] Fix form submissions with non-UTF-8 data crashing the CP listing#14461

Merged
jasonvarga merged 2 commits into6.xfrom
form-submission-binary-data
Apr 8, 2026
Merged

[6.x] Fix form submissions with non-UTF-8 data crashing the CP listing#14461
jasonvarga merged 2 commits into6.xfrom
form-submission-binary-data

Conversation

@duncanmcclean
Copy link
Copy Markdown
Member

@duncanmcclean duncanmcclean commented Apr 8, 2026

This pull request fixes an issue where form submissions containing non-UTF-8 bytes (e.g. from spam bots injecting binary data, or copy-pasted text from Word/Google Docs containing control characters) would crash the entire CP forms listing.

This was happening because Symfony's YAML dumper stores non-UTF-8 values using the !!binary tag with base64 encoding. This is valid YAML, so the existing ParseException catch in FormSubmissionsStore::makeItemFromFile() doesn't trigger. The decoded binary data then passes through to the CP's JSON response, where json_encode() throws an InvalidArgumentException: Malformed UTF-8 characters.

This PR fixes it by sanitizing parsed submission data after YAML parsing, stripping any invalid UTF-8 bytes before the data reaches JSON serialization.

Fixes #14447

@jasonvarga jasonvarga merged commit 8d7357a into 6.x Apr 8, 2026
17 checks passed
@jasonvarga jasonvarga deleted the form-submission-binary-data branch April 8, 2026 17:45
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.

Form submissions with !!binary YAML tags crash the CP forms listing (bypasses #6860 fix)

2 participants