Bug #79363 [Nab]: \p{L} doesn't work alongside \p{Arabic} in a character class
| From: | halaeiv at gmail dot com | Date: | Tue, 30 Jun 2020 11:06:16 +0000 |
| Subject: | Bug #79363 [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-227739@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
User updated by: halaeiv at gmail dot com
Reported by: halaeiv at gmail dot com
Summary: \p{L} doesn't work alongside \p{Arabic} in a
character class
Status: Not a bug
Type: Bug
Package: PCRE related
Operating System: Ubuntu
PHP Version: 7.4.3
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
PCRE 10.35 is released with the bug being fixed. But it is not still used in PHP 7.4 branch. So I
believe this issue is now a PHP bug and should be reopened. Any plan to fix?
Previous Comments:
------------------------------------------------------------------------
[2020-03-11 08:49:30] cmb@php.net
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
------------------------------------------------------------------------
[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