Comment 2 for bug 1548442

Revision history for this message
Neal Gompa (ngompa13) wrote :

After working with Remi Collet to track down the issue, we've identified the problem to be with PCRE support, specifically with PCRE JIT. We reached this suspicion after Remi was able to run the tests successfully with his PHP7 SCL for Fedora 23 just fine with the JIT enabled, but it broke on CentOS 7.2 and Ubuntu Xenial.

I tested on Ubuntu Xenial php7.0-7.0.3-9 (from xenial-proposed) and CentOS 7.2 php70-php-7.0.3-1.el7.remi SCL (from Remi's repository).

On both systems, I did the following:

0. Installed the required php7 packages.
** Ubuntu Xenial: php7.0-{cli,json,xml,mbstring}
** CentOS 7.2 php70 scl: php70-php-{cli,json,xml,mbstring}

1. Downloaded Twig 1.24.0 tarball from GitHub (https://github.com/twigphp/Twig/archive/v1.24.0/Twig-1.24.0.tar.gz)

2. Untarred it and changed into the new Twig-1.24.0 directory.

3. Downloaded composer.phar ( https://getcomposer.org/composer.phar ) and phpunit.phar ( https://phar.phpunit.de/phpunit.phar )
4. Run composer to set up the Twig sources.
** Ubuntu Xenial: php7.0 composer.phar install
** CentOS 7.2 php70 scl: php70 composer.phar install

5. Run phpunit on the Twig sources.
** Ubuntu Xenial: php7.0 phpunit.phar -v
** CentOS 7.2 php70 scl: php70 phpunit.phar -v

With the default configuration, these both fail with a segmentation fault.

However, if I add "pcre.jit=0" to php.ini (/etc/php/7.0/cli/php.ini on Ubuntu Xenial, /etc/opt/remi/php70/php.ini for CentOS 7.2 php70 scl) and re-run the tests, they pass completely.

There are two solutions here:
1) Identify what Fedora's pcre package has that fixes it vs the Debian/Ubuntu package (Fedora sources available here: http://pkgs.fedoraproject.org/cgit/rpms/pcre.git/tree/?h=f23), as both are using pcre 8.38, though I don't know why the soversion differs...
2) Add "pcre.jit=0" to the php configuration.

I don't consider solution 2 to be valid unless we're okay with disabling PCRE JIT across the board.