Bug #79363 [Opn->Nab]: \p{L} doesn't work alongside \p{Arabic} in a character class
| From: | cmb@php.net | Date: | Wed, 11 Mar 2020 08:49:30 +0000 |
| Subject: | Bug #79363 [Opn->Nab]: \p{L} doesn't work alongside \p{Arabic} in a character class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226020@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79363&edit=1
ID: 79363
Updated by: cmb@php.net
Reported by: halaeiv at gmail dot com
Summary: \p{L} doesn't work alongside \p{Arabic} in a
character class
-Status: Open
+Status: Not a bug
Type: Bug
Package: PCRE related
Operating System: Ubuntu
PHP Version: 7.4.3
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Indeed, this is not a bug in PHP, but rather in libpcre. In
libpcre 10.34, the behavior has been improved, but is still not
quite right (with JIT enabled):
00000000000
lower UPPER
Previous Comments:
------------------------------------------------------------------------
[2020-03-11 08:04:39] halaeiv at gmail dot com
There is a related bug report in pcre:
https://bugs.exim.org/show_bug.cgi?id=2432
The bug's status is new, but it is mentioned that it was fixed in 10.34.
I hope the next PHP version will fix it. There can be some additional tests to check.
Note: the preg works with (*NO_JIT).
------------------------------------------------------------------------
[2020-03-10 13:37:17] halaeiv at gmail dot com
Description:
------------
I ran the following code in both PHP 7.2.28 and PHP 7.4.3. The output of PHP 7.4.3 is wrong.
Basically, adding a \p{Arabic} after \p{L} seems to causes \p{L} to match uppercases and spaces,
instead of letters.
Test script:
---------------
$str = 'lower UPPER';
echo(preg_replace('/[\p{L}\p{Arabic}]/', '0', $str));
echo "\n";
echo(preg_replace('/[^\p{L}\p{Arabic}]/', '0', $str));
echo "\n";
Expected result:
----------------
00000 00000
lower0UPPER
Actual result:
--------------
lower000000
00000 UPPER
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79363&edit=1