|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80118 Enabled pcre.jit gives different matches results than disabled pcre.jit
Submitted: 2020-09-17 17:26 UTC Modified: 2020-09-19 10:45 UTC
From: zhiyangleecn at gmail dot com Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 7.4.10 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: zhiyangleecn at gmail dot com
New email:
PHP Version: OS:


 [2020-09-17 17:26 UTC] zhiyangleecn at gmail dot com
The regular expression ~[^/p{Han}/p{Z}]~u will match a single character not present in the list below:
 -Any characters in the Han script.
 -Any kind of whitespace or invisible separator

In fact, when pcre.jit is enabled, this regular expression will match a whitespace, which may be an incorrect match.


PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 10.34 2019-11-21
PCRE Unicode Version => 12.1.0
PCRE JIT Support => enabled
PCRE JIT Target => x86 64bit (little endian + unaligned)

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

Test script:
ini_set('pcre.jit', 0);
preg_match('~[^\p{Han}\p{Z}]~u', '     ', $matches);

ini_set('pcre.jit', 1);
preg_match('~[^\p{Han}\p{Z}]~u', '     ', $matches);

Expected result:
array(0) {

array(0) {

Actual result:
array(0) {

array(1) {
  string(1) " "


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-17 17:44 UTC]
-Package: PCRE related +Package: JIT
 [2020-09-17 18:42 UTC]
-Status: Open +Status: Duplicate -Package: JIT +Package: PCRE related
 [2020-09-17 18:42 UTC]

Likely a duplicate of bug #79363 that is fixed in PCRE 10.35, PHP 8.0, and will be fixed in PHP 7.4 when possible.
 [2020-09-17 21:45 UTC]
"PCRE's JIT. Not PHP's JIT." 

ugh, my bad. original package was right then.
 [2020-09-17 22:11 UTC]
-Status: Duplicate +Status: Open
 [2020-09-17 22:11 UTC]
> Likely a duplicate of bug #79363 […]

Unfortunately not: <>.

I presume this is a libpcre2 issue (possibly already fixed in the
development branch).

> […] that is fixed in PCRE 10.35, and will be fixed in PHP 7.4 when possible.

That has just happened:
 [2020-09-18 08:52 UTC]
-Status: Open +Status: Suspended -Assigned To: +Assigned To: cmb
 [2020-09-18 08:52 UTC]
This is apparently an unresolved regression in libpcre2.  I have
filed <>, and suspend
this ticket for the time being.
 [2020-09-19 10:45 UTC]
-Status: Suspended +Status: Analyzed
 [2020-09-19 10:45 UTC]
The upstream issue has already been resolved.
 [2020-09-19 10:46 UTC]
The following pull request has been associated:

Patch Name: Fix #80118: Erroneous whitespace match with JIT only
On GitHub:
 [2020-09-21 08:30 UTC]
Automatic comment on behalf of
Log: Fix #80118: Erroneous whitespace match with JIT only
 [2020-09-21 08:30 UTC]
-Status: Analyzed +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 18 02:03:38 2021 UTC