Bug #80118 [NEW]: Enabled pcre.jit gives different matches results than disabled pcre.jit
| From: | zhiyangleecn at gmail dot com | Date: | Thu, 17 Sep 2020 17:26:57 +0000 |
| Subject: | Bug #80118 [NEW]: Enabled pcre.jit gives different matches results than disabled pcre.jit | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-229057@lists.php.net to get a copy of this message | ||
From: zhiyangleecn at gmail dot com
Operating system: Any
PHP version: 7.4.10
Package: PCRE related
Bug Type: Bug
Bug description:Enabled pcre.jit gives different matches results than disabled pcre.jit
Description:
------------
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:
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:
---------------
pcre_jit_off.php:
<?php
ini_set('pcre.jit', 0);
preg_match('~[^\p{Han}\p{Z}]~u', ' ', $matches);
var_dump($matches);
pcre_jit_on.php:
<?php
ini_set('pcre.jit', 1);
preg_match('~[^\p{Han}\p{Z}]~u', ' ', $matches);
var_dump($matches);
Expected result:
----------------
pcre_jit_off.php:
array(0) {
}
pcre_jit_on.php:
array(0) {
}
Actual result:
--------------
pcre_jit_off.php:
array(0) {
}
pcre_jit_on.php:
array(1) {
[0]=>
string(1) " "
}
--
Edit bug report at https://bugs.php.net/bug.php?id=80118&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80118&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80118&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80118&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80118&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80118&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80118&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80118&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80118&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80118&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80118&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80118&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80118&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80118&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80118&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80118&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80118&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80118&r=mysqlcfg