Last modified: 2014-08-22 18:27:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60640, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58640 - mediawiki-1.22.0, pcre-8.34 (using php-5.5.7): Pages with content displayed as blank/empty when $regex groups start with digit
mediawiki-1.22.0, pcre-8.34 (using php-5.5.7): Pages with content displayed a...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.22.0
All Linux
: High major with 2 votes (vote)
: 1.22.x release
Assigned To: Kevin Israel (PleaseStand)
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-18 12:02 UTC by Timo Gurr
Modified: 2014-08-22 18:27 UTC (History)
15 users (show)

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


Attachments
php-5.5.7-with-pcre-8.34.jpg (10.68 KB, image/jpeg)
2013-12-18 12:02 UTC, Timo Gurr
Details
php-5.5.7-with-pcre-8.33.jpg (19.71 KB, image/jpeg)
2013-12-18 12:03 UTC, Timo Gurr
Details
A quick ugly hack that should make MW work with PCRE 8.34 (781 bytes, patch)
2013-12-18 15:02 UTC, Bartosz Dziewoński
Details
Quick and dirty PCRE 8.34 compat patch (1.18 KB, patch)
2013-12-19 10:41 UTC, Kevin Israel (PleaseStand)
Details

Description Timo Gurr 2013-12-18 12:02:56 UTC
Created attachment 14126 [details]
php-5.5.7-with-pcre-8.34.jpg

After upgrading pcre from version 8.33 to 8.34 mediawiki-1.22.0 shows some undesired/broken behaviour.

* descriptive text when editing a page is missing (see attached screenshots)
* pages with content displayed as blank/empty

Apache error.log shows the following:

[Wed Dec 18 11:40:32.819810 2013] [:error] [pid 20885] [client 127.0.0.1:57571] PHP Warning:  Invalid argument supplied for foreach() in /var/www/wiki/htdocs/includes/MagicWord.php on line 882, referer: http://wiki.domain/index.php/Hauptseite
[Wed Dec 18 11:40:32.819841 2013] [:error] [pid 20885] [client 127.0.0.1:57571] PHP Warning:  preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/wiki/htdocs/includes/MagicWord.php on line 886, referer: http://wiki.domain/index.php/Hauptseite
[Wed Dec 18 11:40:32.819871 2013] [:error] [pid 20885] [client 127.0.0.1:57571] PHP Warning:  preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /var/www/wiki/htdocs/includes/MagicWord.php on line 881, referer: http://wiki.domain/index.php/Hauptseite

Side note: Downgrading pcre back to 8.33 didn't solve the problem with the "emtpy" pages immediately, I had to edit and save them (without changing the content) to get the content displayed again.
Comment 1 Timo Gurr 2013-12-18 12:03:20 UTC
Created attachment 14127 [details]
php-5.5.7-with-pcre-8.33.jpg
Comment 2 Bartosz Dziewoński 2013-12-18 12:21:34 UTC
The regexes used on these lines (the $regex variable) do seem to have named groups starting with a digit, e.g.

/(?P<0_notoc>__NOTOC__)|(?P<0_nogallery>__NOGALLERY__)|(?P<0_forcetoc>__FORCETOC__)|(?P<0_toc>__TOC__)|(?P<0_noeditsection>__NOEDITSECTION__)|(?P<0_notitleconvert>__NOTITLECONVERT__)|(?P<1_notitleconvert>__NOTC__)|(?P<0_nocontentconvert>__NOCONTENTCONVERT__)|(?P<1_nocontentconvert>__NOCC__)/iuS

I'm not quite sure what generates them right now, but it could probably be changed to, say, insert a '_' at the beginning of the name or something.
It's rather silly of PCRE to break compatibility like that, though…
Comment 3 aommundsen 2013-12-18 14:33:51 UTC
I can confirm this bug in both MediaWiki 1.20.8 and 1.22.0, they do not work on servers using PCRE 8.34. I have posted about it here: http://www.mediawiki.org/w/index.php?title=Project:Support_desk#MediaWiki_don.27t_work_with_PCRE_8.34_37016

Here is from apache usage log:

[Wed Dec 18 14:07:46.351691 2013] [:error] [pid 8193] [client 12.12.12.12:53455] PHP Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/xxx/domains/xxx.com/public_html/w/includes/MagicWord.php on line 907, referer: http:// xxx.no/w/index.php/Hovedside

When I look at PCRE 8.34 changelog at http://pcre.org/news.txt it says this:

"Perl no longer allows group names to start with digits, so I have made this change also in PCRE."

Can someone please help by providing a patch that I can apply to MagicWord.php, so that I don't have to downgrade PCRE?

I am running Apache 2.4.7, PHP 5.4.23 and PCRE 8.34. No most pages on the MediaWiki site is empty without content. So I need a quick solution.
Comment 4 Bartosz Dziewoński 2013-12-18 15:02:34 UTC
Created attachment 14128 [details]
A quick ugly hack that should make MW work with PCRE 8.34

(In reply to comment #3)
> Can someone please help by providing a patch that I can apply to
> MagicWord.php,
> so that I don't have to downgrade PCRE?
> 
> I am running Apache 2.4.7, PHP 5.4.23 and PCRE 8.34. No most pages on the
> MediaWiki site is empty without content. So I need a quick solution.

The attached patch doesn't seem to break the wiki horribly at a glance and should work with the new restrictions (although I haven't tried it). It's also definitely the wrong way to solve this problem in the long run.
Comment 5 aommundsen 2013-12-18 15:29:59 UTC
Thank you, Bartosz. However it did not work for me. I applied your change from the patch, and then I purged the cache on the front page like it says here: http://www.mediawiki.org/wiki/Manual:Purge

However the content of the page is still empty, only the title and menus etc is visible, but the content of the article is blank/empty (like it was before I applied the patch)

I also continue to get the same warning in apache error log as I posted in reply above. :(
Comment 6 aommundsen 2013-12-19 10:02:38 UTC
It's still assigned to nobody, so I guess I am out of look and need to dowgrade pcre. This situation is no fun at all.
Comment 7 Kevin Israel (PleaseStand) 2013-12-19 10:40:16 UTC
(In reply to comment #5)
> Thank you, Bartosz. However it did not work for me.

That's because the (?P< part of the regex is built in the MagicWordArray class,
not in the MagicWord class. Both classes are in the same file.

I'll upload a new version of the patch now. All parser tests pass with PHP 5.5.7 and PCRE 8.34 on my system. Let us know if it works.
Comment 8 Kevin Israel (PleaseStand) 2013-12-19 10:41:02 UTC
Created attachment 14135 [details]
Quick and dirty PCRE 8.34 compat patch
Comment 9 aommundsen 2013-12-19 11:29:50 UTC
Thank you, Kevin! Your patch works! I applied your patch to MediaWiki 1.20.8, and do not have any problems.

However some of the pages was cached with the old problem missing content, I solved this quickly by running the command to upgrade (without upgrading, because that command also purges the cache:

cd /home/USER/domains/DOMAIN.COM/public_html/w/maintenance
php update.php

Again, thanks! I hope this patch soon is added to a new MediaWiki version. :)
Comment 10 nikus0pokus 2013-12-21 12:05:03 UTC
Another quick solution is to go back to PCRE 8.33 until a correction was made.
Comment 11 lilydjwg 2013-12-22 07:40:32 UTC
I've downgrade PCRE 8.33 too. Waiting for the fix to release now :-)

aommundsen: appending "?action=purge" can refresh the cache of indivisual pages.
Comment 12 Gerrit Notification Bot 2013-12-22 08:10:23 UTC
Change 103215 had a related patch set uploaded by PleaseStand:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/103215
Comment 13 Kevin Israel (PleaseStand) 2013-12-22 08:41:42 UTC
I have added this to <https://www.mediawiki.org/wiki/MediaWiki_1.22/Known_issues> and uploaded a new version of the patch to Gerrit so this can be fixed in the next release.
Comment 14 Nemo 2013-12-30 09:29:20 UTC
Update per https://www.mediawiki.org/w/index.php?title=MediaWiki_1.22/Known_issues&oldid=847749 which seems to be the master list.
Comment 15 Gerrit Notification Bot 2013-12-31 05:32:12 UTC
Change 103215 merged by jenkins-bot:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/103215
Comment 16 Bartosz Dziewoński 2013-12-31 15:42:50 UTC
Fixed in master. Mark, do we want to backport this?
Comment 17 Gerrit Notification Bot 2014-01-13 23:03:25 UTC
Change 107259 had a related patch set uploaded by MarkAHershberger:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/107259
Comment 18 Gerrit Notification Bot 2014-01-13 23:08:14 UTC
Change 107259 merged by jenkins-bot:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/107259
Comment 19 Andre Klapper 2014-01-14 10:42:18 UTC
[Patch merged into REL1_22 branch + available in 1.22.1 tarball; closing again]
Comment 20 Kevin Israel (PleaseStand) 2014-01-14 11:03:54 UTC
Comment on attachment 14135 [details]
Quick and dirty PCRE 8.34 compat patch

Marking my initial patch as obsolete. Current patch (applied to master and REL1_22, and released as part of 1.22.1) is:

<https://git.wikimedia.org/patch/mediawiki%2Fcore.git/b9f291e8cd5bb1450f7b1031aa17cf7775aa7e96>

Not (yet?) applied to REL1_19 or REL1_21.
Comment 21 taraathan@gmail.com 2014-03-31 17:48:30 UTC
Please apply this patch to the Long-Term Support Release 1.19. My webhost just upgraded PCRE and now all my wiki pages are blank.
Comment 22 Gerrit Notification Bot 2014-03-31 18:26:16 UTC
Change 122449 had a related patch set uploaded by PleaseStand:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/122449
Comment 23 Gerrit Notification Bot 2014-03-31 18:27:02 UTC
Change 122450 had a related patch set uploaded by PleaseStand:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/122450
Comment 24 Gerrit Notification Bot 2014-04-01 18:59:38 UTC
Change 122449 merged by jenkins-bot:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/122449
Comment 25 Gerrit Notification Bot 2014-04-01 19:07:07 UTC
Change 122450 merged by jenkins-bot:
Make MagicWordArray compatible with PCRE 8.34+

https://gerrit.wikimedia.org/r/122450
Comment 26 Bartosz Dziewoński 2014-04-03 14:36:30 UTC
(In reply to Tara Athan from comment #21)
> Please apply this patch to the Long-Term Support Release 1.19. My webhost
> just upgraded PCRE and now all my wiki pages are blank.

It was backported to the just-released MediaWiki 1.19.15.
Comment 27 Nemo 2014-04-06 11:04:00 UTC
Barnerd confirmed on IRC that with 1.21.7 the web installer is broken in FreeBSD (message strings not shown), but the patch fixes it. Should be released with 1.21.9 on 2014-04-24 at the latest.
Comment 28 Kevin Weatherly 2014-08-22 16:17:27 UTC
Forgive me for my lack of knowledge. Can someone point me to instructions for applying the patch?
Comment 29 Andre Klapper 2014-08-22 18:27:44 UTC
Links to patches are given above, and as general patch application instructions are not MediaWiki specific, you might either use your favorite search engine or ask on https://www.mediawiki.org/wiki/Project:Support_desk  :)

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


Navigation
Links