Last modified: 2011-03-13 18:05:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11054 - Patch to make mediawiki work in mbstring.func_overload environments
Patch to make mediawiki work in mbstring.func_overload environments
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review, utf8
Depends on:
  Show dependency treegraph
Reported: 2007-08-24 15:33 UTC by Bernhard Weißhuhn
Modified: 2011-03-13 18:05 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Make UtfNormal.php use bytecount wrappers for strlen and substr in case of (mbstring.func_overload & 2) (6.41 KB, patch)
2007-08-24 15:33 UTC, Bernhard Weißhuhn
Patch to UtfNormal.php against svn. (6.46 KB, patch)
2007-08-24 15:43 UTC, Bernhard Weißhuhn

Description Bernhard Weißhuhn 2007-08-24 15:33:54 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.

comments welcome,
Comment 1 Bernhard Weißhuhn 2007-08-24 15:35:22 UTC
whoops, that patch is against my internal svk depot revision numbers, I'll supply one against mw svn. Sorry!
Comment 2 Bernhard Weißhuhn 2007-08-24 15:43:39 UTC
Created attachment 4037 [details]
Patch to UtfNormal.php against svn.

same same but different ;)
Comment 3 Niklas Laxström 2007-11-30 14:19:50 UTC
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?
Comment 4 Brion Vibber 2007-12-03 21:01:17 UTC
The function override mode will pretty much break things randomly, and should never be used by anybody.

Note You need to log in before you can comment on or make changes to this bug.