Page MenuHomePhabricator

HtmlFormatter class doesn't use fallback for mb_convert_encoding if mbstring is not available
Closed, ResolvedPublic

Description

MediaWiki doesn't require PHP to have support for mbstring [1] (it has fallback functions to handle that)

The HtmlFormatter class, part of MediaWiki core in MediaWiki 1.22 that's being used only by Mobile Frontend for now, is accessing "mb_" PHP functions that aren't being defined as fallback, giving fatal errors when PHP doesn't have mbstring support.

The missing function is mb_convert_encoding

We should provide a fallback function for it, or check if ( function_exists( 'mb_convert_encoding' ) ) before using it (as it's being done in DatabasePostgres.php line 437

It currently breaks Mobile Frontend on installations without mbstring


[1] https://www.mediawiki.org/wiki/PHP_configuration#Optional


Version: 1.22.0
Severity: normal
URL: https://www.mediawiki.org/wiki/Thread:Project:Support_desk/_Extension_:_%28MobileFrontEnd%29_-_!ERROR!_-_Blank_Page

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:02 AM
bzimport set Reference to bz60174.
bzimport added a subscriber: Unknown Object (MLST).

Change 228778 had a related patch set uploaded (by Florianschmidtwelzow):
Move ext-mbstring to require section in composer.json

https://gerrit.wikimedia.org/r/228778

Change 228778 abandoned by Florianschmidtwelzow:
Move ext-mbstring to require section in composer.json

https://gerrit.wikimedia.org/r/228778

Florian removed a project: Patch-For-Review.
Florian set Security to None.
Ciencia_Al_Poder raised the priority of this task from Low to Medium.Aug 21 2015, 9:25 AM

It's affecting api.php now: https://www.mediawiki.org/wiki/Topic:Sndkebuz3sy5984k

Raising priority, since it's not just MF, but core features, and more core features will be using this...

Change 232935 had a related patch set uploaded (by Anomie):
Provide fallbacks for use of mb_convert_encoding() in HtmlFormatter

https://gerrit.wikimedia.org/r/232935

Change 232935 merged by jenkins-bot:
Provide fallbacks for use of mb_convert_encoding() in HtmlFormatter

https://gerrit.wikimedia.org/r/232935

Anomie claimed this task.

Change 237601 had a related patch set uploaded (by Martineznovo):
Provide fallbacks for use of mb_convert_encoding() in HtmlFormatter

https://gerrit.wikimedia.org/r/237601

Change 237601 merged by jenkins-bot:
Provide fallbacks for use of mb_convert_encoding() in HtmlFormatter

https://gerrit.wikimedia.org/r/237601