Bug #80118 [Dup->Opn]: Enabled pcre.jit gives different matches results than disabled pcre.jit

From: Date: Thu, 17 Sep 2020 22:11:10 +0000
Subject: Bug #80118 [Dup->Opn]: Enabled pcre.jit gives different matches results than disabled pcre.jit
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229062@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80118&edit=1 ID: 80118 Updated by: cmb@php.net Reported by: zhiyangleecn at gmail dot com Summary: Enabled pcre.jit gives different matches results than disabled pcre.jit -Status: Duplicate +Status: Open Type: Bug Package: PCRE related Operating System: Any PHP Version: 7.4.10 Block user comment: N Private report: N New Comment: > Likely a duplicate of bug #79363 […] Unfortunately not: <https://3v4l.org/eqms1>. 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: <https://github.com/php/php-src/commit/9f2d03952daf5348d7f18c18e82607979e28df12>. Previous Comments: ------------------------------------------------------------------------ [2020-09-17 21:45:45] danack@php.net "PCRE's JIT. Not PHP's JIT." ugh, my bad. original package was right then. ------------------------------------------------------------------------ [2020-09-17 18:42:52] requinix@php.net PCRE's JIT. Not PHP's JIT. 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 17:26:57] zhiyangleecn at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=80118&edit=1

« previous php.bugs (#229062) next »