|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75223 PCRE JIT broken in 7.2
Submitted: 2017-09-18 11:58 UTC Modified: 2017-09-18 20:42 UTC
From: giovanni at giacobbi dot net Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 7.2.0RC2 OS: Linux CentOS 7.4.1708
Private report: No CVE-ID: None
 [2017-09-18 11:58 UTC] giovanni at giacobbi dot net
There is a problem in preg_match() when JIT is enabled and when running through Apache2 with event MPM. This problem does not occur with command line invocation.

Here are the versions I tested, same environment:
7.1.9  works with PCRE JIT enabled
7.2.0alpha1   broken
7.2.0rc2  broken

Build command line:
./configure \
  --with-apxs2=/usr/local/apache2/bin/apxs \
  --disable-cgi \
  --enable-intl \
  --with-layout=GNU \
  --enable-maintainer-zts \
  --with-gettext=static \
  --with-iconv \
  --with-mysqli=mysqlnd \
  --enable-exif \
  --with-openssl \

Test script:
var_dump(preg_match('/^a/', "a"));
var_dump(preg_match('/a/', "a"));

Expected result:

Actual result:
segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-18 12:14 UTC]
Please provide a backtrace.
 [2017-09-18 13:45 UTC]
Sorry, I cannot reproduce.

$ php72 -n -i | grep PCRE
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 8.41 2017-07-05
PCRE JIT Support => enabled

$ php72 -n  foo.php 
 [2017-09-18 14:05 UTC]
Remi, just to be sure: did you test it with Apache2 with event MPM? According to the reporter it does not occur with the command line, only with the Apache2 with event MPM SAPI.
 [2017-09-18 14:53 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2017-09-18 14:53 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2017-09-18 18:36 UTC] giovanni at giacobbi dot net
-Status: Feedback +Status: Closed
 [2017-09-18 18:36 UTC] giovanni at giacobbi dot net
I can confirm that the following fixes the issue:
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 02 10:01:26 2023 UTC