Last modified: 2011-03-13 18:05:02 UTC
Created attachment 4036 [details]
Make UtfNormal.php use bytecount wrappers for strlen and substr in case of (mbstring.func_overload & 2)
Setting mbstring.func_overload in php.ini to override the string functions (strlen, substr, strpos...) breaks the functionality of UtfNormal.php, which relies on these functions to work with byte counts (as opposed to logical characters).
If you happen to be in an environment where this setting is active, mediawiki will garble request data, transcoding some of your non-Ascii characters and passing through others. Since the ini-settings cannot be disabled at runtime, I wrote wrappers for strlen and substr which always work on byte counts regardless of mbstring.func_overload.
btw: I tried setting mb_internal_encoding to '8bit' for mediawiki pages, but this did not affect the behaviour of the overloaded functions.
whoops, that patch is against my internal svk depot revision numbers, I'll supply one against mw svn. Sorry!
Created attachment 4037 [details]
Patch to UtfNormal.php against svn.
same same but different ;)
Do we really want this? I would assume other things in mediawiki would break too. Or is utfnormal the only thing? Could we just require overloading to be off?
The function override mode will pretty much break things randomly, and should never be used by anybody.