Skip to content
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

Please stop modifying global settings such as default_charset and mb_internal_encoding(). This leads to data corruption and bug reports in other packages. #207

Open
cmanley opened this issue May 9, 2024 · 0 comments

Comments

@cmanley
Copy link

cmanley commented May 9, 2024

I recently had an application that started having data corruption issues.
It all worked fine until another package installed this package as a dependency.
I traced it back to voku/helper/UTF8.php calling \mb_internal_encoding('UTF-8') while the application had set mb_internal_encoding to cp1252 during start up.
But that's not all, voku/helper/Bootup.php also calls ini_set('default_charset', 'UTF-8')

That is a very bad design practice imho. It's not right to just go around changing application settings and globals in a package meant for non-private use.

If one really has to modify a global (which I doubt), then it should be done temporarily and wrapped in a try...finally to reset it back.

@cmanley cmanley changed the title Please stop messing with global settings such as mb_internal_encoding(). This causes data corruption. Please stop modifying global settings such as mb_internal_encoding(). This leads to data corruption and bug reports in other packages. May 9, 2024
@cmanley cmanley changed the title Please stop modifying global settings such as mb_internal_encoding(). This leads to data corruption and bug reports in other packages. Please stop modifying global settings such as default_charset and mb_internal_encoding(). This leads to data corruption and bug reports in other packages. May 9, 2024
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

No branches or pull requests

1 participant