Page MenuHomePhabricator

Warning with PCRE<7.2: preg_match(): Compilation failed: assertion expected after (?( at offset 115 in /var/www/html/w/includes/utils/IP.php on line 88
Closed, ResolvedPublic

Description

When trying to install MediaWiki on CentOS 5 (using the packaged version of PHP 5.3.3), I got the following error:

Creating administrator user account... Warning: preg_match(): Compilation failed: assertion expected after (?( at offset 115 in /var/www/html/w/includes/utils/IP.php on line 88 Warning: preg_match(): Compilation failed: assertion expected after (?( at offset 115 in /var/www/html/w/includes/utils/IP.php on line 88 done

This is probably because of gerrit 66304, which rendered the regex
RE_IPV6_ADD incompatible with the PCRE 6.6 that comes with CentOS 5,
though CentOS 6 should be fine.

So we have two options:

  • decide not to support PHP binaries that are built to use a system version of PCRE older than 7.2, adding to the installer a check for this; or
  • revert the change.

In either case, the patch should be backported to 1.22.


Version: 1.22.0
Severity: normal

Details

Reference
bz58213

Event Timeline

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

Change 100390 had a related patch set uploaded by PleaseStand:
Restore compatibility with curl < 7.16.2

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

(In reply to comment #1)

Change 100390 had a related patch set uploaded by PleaseStand:
Restore compatibility with curl < 7.16.2

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

Wrong bug...

I guess the CentOS version of PHP is compiled with a specific PCRE version which is most probably the one coming with the OS instead of the one bundled within PHP.

Kevin can you run php -i and paste there the 'pcre' section? Example output for me (Mac OS X):

pcre

PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 8.02 2010-03-19

Directive => Local Value => Master Value
pcre.backtrack_limit => 1000000 => 1000000
pcre.recursion_limit => 100000 => 100000

On a Precise instance having php5 5.3.10-1ubuntu3.8+wmf2

PCRE Library Version => 8.12 2011-01-15

Can you also paste the result of ldd /usr/bin/php |fgrep pcre. Again on Precise that yields:

libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f6a65e75000)

Then use readlink against the /lib.. file to find out the version:

$ readlink /lib/x86_64-linux-gnu/libpcre.so.3
libpcre.so.3.12.1
$

And the version of libpcre has given by rpm or yum :-D

PHP 5.3.3 (out in July 2010) comes with bundled PCRE version 8.0. Additionally CentOS package does not use the expected pcre version so I am afraid this bug is going to be a WONTFIX.

(In reply to comment #3)

Kevin can you run php -i and paste there the 'pcre' section? Example output
for me (Mac OS X):

Configure Command => './configure' '--build=i386-redhat-linux-gnu'
[...] '--with-pcre-regex=/usr' [...]

pcre

PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 6.6 06-Feb-2006

Directive => Local Value => Master Value
pcre.backtrack_limit => 100000 => 100000
pcre.recursion_limit => 100000 => 100000

So yes, the PCRE version is the problem.

PHP 5.3.3 (out in July 2010) comes with bundled PCRE version 8.0.
Additionally
CentOS package does not use the expected pcre version so I am afraid this bug
is going to be a WONTFIX.

Agreed. I nevertheless filed this report so I have something to refer to when I add an installer check for it.

  • Bug 58253 has been marked as a duplicate of this bug. ***

So if we don't revert the change, for those who are stuck on RHEL/CentOS 5 and are using that distribution's php53 package, we would advise upgrading to PHP 5.4 using any of several unofficial RPMs/repos that don't use the system PCRE.

Would that be an acceptable answer, or is it in fact necessary to support the base install of this six-year-old distribution for a little while longer (until PHP 5.3 support is dropped)?

(In reply to comment #6)

So if we don't revert the change, for those who are stuck on RHEL/CentOS 5
and
are using that distribution's php53 package, we would advise upgrading to PHP
5.4 using any of several unofficial RPMs/repos that don't use the system
PCRE.

They could as well upgrade to a php53 package that wasn't compiled against the system PCRE.

It may even be possible that they could just upgrade their system PCRE.

Discussion is getting split between this bug and bug 58253.

Copying the Marks and bug 58253 is cross-referenced with [[mw:MediaWiki 1.22/Known issues]].

Change 102081 had a related patch set uploaded by PleaseStand:
Check for very old PCRE versions in installer and updater

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

The patch points to a MediaWiki page that is supposed to offer some explanation:
https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms/PCRE

However, that page is empty. Is there a better article to point to?

As explained in the comments on the patch, that page is currently a draft
located in user-space.

  • Bug 59765 has been marked as a duplicate of this bug. ***

Change 108843 had a related patch set uploaded by MarkAHershberger:
Check for very old PCRE versions in installer and updater

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

Change 108843 merged by jenkins-bot:
Check for very old PCRE versions in installer and updater

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

Change 102081 merged by jenkins-bot:
Check for very old PCRE versions in installer and updater

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

Patch merged to 1.22.x and git master. Closing as FIXED.