php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78420 preg_match failed with Unicode character scripts
Submitted: 2019-08-16 09:51 UTC Modified: 2019-08-24 09:28 UTC
From: noskov dot vlad at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: PCRE related
PHP Version: 7.4.0beta2 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: noskov dot vlad at gmail dot com
New email:
PHP Version: OS:

 

 [2019-08-16 09:51 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-16 10:04 UTC] requinix@php.net
Works with JIT disabled.
 [2019-08-16 10:04 UTC] 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 11:56 UTC] cmb@php.net
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>
 [2019-08-20 14:25 UTC] noskov dot vlad at gmail dot com
PCRE2 bug report: https://bugs.exim.org/show_bug.cgi?id=2432
 [2019-08-24 09:28 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-08-24 09:28 UTC] cmb@php.net
This has been confirmed to be an upstream issue (which has been
already resolved), so I'm closing this ticket.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 08:01:27 2024 UTC