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
[4.2] PHP8.2 Replace deprecated utf8 encode/decode to mb string #39583
Conversation
No, we absolutely shouldn't! The reason
I am unwilling to consider this PR a good solution because Unless that page is amended to list mbstring as a hard requirement it makes far more sense to follow the approach in #38922 with a function which uses whatever is actually available — including a fallback to a pure PHP implementation. Do note that the code in #38922 is in fact following the “Throwing the kitchen sink at it” section of the PHP RFC for As a second stage we should look at every instance of |
I really like the idea to recheck if the code still makes sense and then remove what is not really needed. For now to improve compatibility I would prefer to replace the deprecated functions with alternatives. From a maintenance perspective I would not add two helper functions which do basically replace 5 native function calls, even when it requires to change the compatibility requirements. |
@laoneo I was thinking of a one-two approach. First add a drop-in replacement marked as This would be perfectly viable with regards to semantic versioning as Why do that instead of just doing the second step? To make sure that real world use of the replacement doesn't cause any issues in use cases we have never thought of or could have expected just by looking at the code. I am a bit conservative here but I have seen… THINGS 🤣 |
We have been discussing this in maintainers and in #38922. Making the mbstring polyfill an explicit dependency and converting the core code to mbstring is the least disruptive change to improve PHP 8.2 compatibility in the 4.x series. |
I have tested this item ✅ successfully on 68ee206 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39583. |
I have tested this item ✅ successfully on f3e4c20 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39583. |
I restored test result from @carlitorweb because it was lost for some reasons. RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39583. |
Thank you |
Pull Request for Issue #38258 and partially for #38922.
Summary of Changes
This pr replaces the few calls to utf8_encode/utf8_decode to mbstring. It uses hardcoded the latin 1 character set (ISO-8859-1).
[Update]
It also makes the mbstring polyfill an explicit dependency, so we ensure that it still works on hosts, which do not have the mbstring module loaded.
If we should support all, then 'ISO-8859-1' can be replaced with mb_list_encodings().See comment below why not!Testing Instructions
Login in the frontend, and go to the profile user page.
Actual result BEFORE applying this Pull Request
A deprecated warning is shown.
Expected result AFTER applying this Pull Request
No deprecated warning is shown.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed