Page MenuHomePhabricator

MW 1.20 complains about pcre in replaceExternalLinks() in Parser.php when preg_split() returns false
Closed, DuplicatePublic

Description

From mediawiki-l: http://thread.gmane.org/gmane.org.wikimedia.mediawiki/40558

I just upgraded to MW 1.20, and now I'm getting this error after setting $wgShowExceptionDetails to true (I turn it on when I get an error message suggesting it, make a request to check, and turn it back off, don't worry):

MediaWiki internal error.

Original exception: exception 'BadTitleError' with message 'The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title.
It may contain one or more characters which cannot be used in titles.' in /xxxxxxxxxx/includes/Wiki.php:197
Stack trace:
#0 /xxxxxxxxxx/includes/Wiki.php(536): MediaWiki->performRequest()
#1 /xxxxxxxxxx/includes/Wiki.php(446): MediaWiki->main()
#2 /xxxxxxxxxx/index.php(59): MediaWiki->run()
#3 {main}

Exception caught inside exception handler: exception 'MWException' with message 'PCRE needs to be compiled with --enable-unicode-properties in order for MediaWiki to function' in /xxxxxxxxxx/includes/parser/Parser.php:1528
Stack trace:
#0 /xxxxxxxxxx/includes/parser/Parser.php(1160): Parser->replaceExternalLinks('')
#1 /xxxxxxxxxx/includes/parser/Parser.php(370): Parser->internalParse('The requested p...')
#2 /xxxxxxxxxx/includes/cache/MessageCache.php(873): Parser->parse('The requested p...', Object(Title), Object(ParserOptions), true)
#3 /xxxxxxxxxx/includes/Message.php(605): MessageCache->parse('The requested p...', Object(Title), true, true, Object(Language))
#4 /xxxxxxxxxx/includes/Message.php(434): Message->parseText('The requested p...')
#5 /xxxxxxxxxx/includes/Message.php(496): Message->toString()
#6 /xxxxxxxxxx/includes/OutputPage.php(3528): Message->parseAsBlock()
#7 /var/www/wikistates.outwardhosting.com/includes/OutputPage.php(2062): OutputPage->addWikiMsgArray('badtitletext', NULL)
#8 /xxxxxxxxxx/includes/Exception.php(342): OutputPage->showErrorPage('badtitle', 'badtitletext', NULL)
#9 /xxxxxxxxxx/includes/Exception.php(374): ErrorPageError->report()
#10 /xxxxxxxxxx/includes/Exception.php(620): BadTitleError->report()
#11 /xxxxxxxxxx/includes/Exception.php(690): MWExceptionHandler::report(Object(BadTitleError))
#12 /xxxxxxxxxx/includes/Wiki.php(449): MWExceptionHandler::handle(Object(BadTitleError))
#13 /xxxxxxxxxx/index.php(59): MediaWiki->run()
#14 {main}

So I downloaded my Linux distribution's source package and recompiled PCRE with the proper options and installed it in the distribution's standard location and restarted Apache, only to get the same error. I ran ldd on both the PHP executable and Apache's libphp5.so and they're pointing to the correct libpcre.so. I'm running PHP 5.3.17.


Version: 1.20.x
Severity: normal

Details

Reference
bz42229

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:13 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz42229.
bzimport added a subscriber: Unknown Object (MLST).

The error is generated in replaceExternalLinks() in Parser.php when preg_split() returns false.

Looking at the PHP documentation (http://php.net/manual/en/function.preg-split.php), the cases preg_split() returns false are not documented. preg_match() says it returns false "if an error occurs" but the only error it documents is "if offset is higher than subject length" which I don't think applies to preg_split().

At the very least, the message (or code comments) should include a pointer to where more information can be found.

Also see bug #26297, maybe the updater should warn?

Adding Chad since he closed bug 26297