Fix Invalid UTF-8 character error for potential malformed user input.#7613
Fix Invalid UTF-8 character error for potential malformed user input.#7613bytes-max wants to merge 2 commits into
Conversation
|
I dont understand how And why is your data not retrieved in UTF-8 encoding? Is your DB connection properly configured? |
|
@Seb33300 I am not sure if and how Symfony internally transforms input variables, but the .env is configured to use the proper Further, I could share the Stack Trace if you're interested, but I don't have it at hand; besides that FWIW I can say that the fix solves the problem for us. If you have helpful other information, please let me know. For now we have the fix in our faulty application where it works now perfectly fine. |
|
The reason why this code triggers the error is that we format the value even if you use a custom formatting. This was a bug on our side and we're fixing it in #7618. About the underlying issue, it might be a data formatting issue. Maybe you can review the data inputs in your app and double check that you are no letting malformed data in? If the database size allows it, you could also create a quick command script with Symfony to find malformed data and fixed it. I did that recently in some Symfony app that was suffering from "mojibake" (double-encoded UTF-8) caused by some UTF-8 → Windows-1252 → UTF-8 data migration. Meanwhile, let's close this PR in favor of the new one. Thanks! |
…is used (javiereguiluz) This PR was merged into the 4.x branch. Discussion ---------- Avoid formatting collection items when a custom formatting is used An alternative solution for the issue reported in #7613. Commits ------- 9b01b13 Avoid formatting collection items when a custom formatting is used
We have observed. that user input some times can be malformed. Whilst its not a big deal for most of the times, some internal methods in easyAdmin cause the whole application to return a 500 page.
For example, a count of comments in a ticket CRUD Index will try to run the affected method, which itself carry potential to be optimized, however it will fail when the input is not correctly transformed to UTF-8.
This is the causing controller code:
The fix prevents the error from happening.