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

Details

Reference
bz60174

Event Timeline

bzimport raised the priority of this task from to Low.
bzimport set Reference to bz60174.
bzimport added a subscriber: Unknown Object (MLST).
Florian claimed this task.Aug 3 2015, 5:54 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 3 2015, 5:54 AM

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 Florian as the assignee of this task.Aug 4 2015, 9:27 PM
Florian removed a project: Patch-For-Review.
Florian set Security to None.
Ciencia_Al_Poder raised the priority of this task from Low to Normal.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

Seb35 added a subscriber: Seb35.Aug 26 2015, 4:02 PM

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

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

Anomie closed this task as Resolved.Sep 10 2015, 2:28 PM
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