portable-utf8 icon indicating copy to clipboard operation
portable-utf8 copied to clipboard

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

Open cmanley opened this issue 1 year ago • 0 comments

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 avatar May 09 '24 16:05 cmanley