Bug #78420 [Opn]: preg_match failed with Unicode character scripts
| From: | cmb@php.net | Date: | Fri, 16 Aug 2019 11:56:06 +0000 |
| Subject: | Bug #78420 [Opn]: preg_match failed with Unicode character scripts | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222271@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78420&edit=1
ID: 78420
Updated by: cmb@php.net
Reported by: noskov dot vlad at gmail dot com
Summary: preg_match failed with Unicode character scripts
Status: Open
Type: Bug
Package: PCRE related
PHP Version: 7.4.0beta2
Block user comment: N
Private report: N
New Comment:
The regression has been introduced by updating to PCRE2 10.33[1],
so apparently is an upstream issue, which might have been resolved
already.
[1] <http://git.php.net/?p=php-src.git;a=commit;h=aa9433e9286801a6af6d4cee73d9a165a61e0e3b>
Previous Comments:
------------------------------------------------------------------------
[2019-08-16 10:06:15] daverandom@php.net
https://3v4l.org/4D17e
------------------------------------------------------------------------
[2019-08-16 10:04:46] daverandom@php.net
The problem is more subtle than this, as the following all work:
var_dump(preg_match('~[\pL\p{Cyrillic}]~u', 'testÐ'));
var_dump(preg_match('~[\pL]~u', 'testÐ'));
var_dump(preg_match('~[\p{Cyrillic}]~u', 'testÐ'));
var_dump(preg_match('~[\pL]~u', 'test'));
var_dump(preg_match('~[\p{Cyrillic}]~u', 'Ð'));
var_dump(preg_match('~\pL~u', 'Ð'));
var_dump(preg_match('~\p{Cyrillic}~u', 'testÐ'));
var_dump(preg_match('~\pL\p{Cyrillic}~u', 'testÐ'));
------------------------------------------------------------------------
[2019-08-16 10:04:29] requinix@php.net
Works with JIT disabled.
------------------------------------------------------------------------
[2019-08-16 09:51:03] noskov dot vlad at gmail dot com
Description:
------------
When running preg_match with Unicode character scripts in regular expression it always return 0.
https://3v4l.org/sil9c
Test script:
---------------
var_dump(preg_match('~[\pL\p{Cyrillic}]~u', 'test'));
Expected result:
----------------
int(1)
Actual result:
--------------
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78420&edit=1