Bug #79233 [Opn]: Unicode character properties not working properly
| From: | cmb@php.net | Date: | Thu, 06 Feb 2020 07:44:04 +0000 |
| Subject: | Bug #79233 [Opn]: Unicode character properties not working properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225381@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79233&edit=1
ID: 79233
Updated by: cmb@php.net
Reported by: yahiru1121 at gmail dot com
Summary: Unicode character properties not working properly
Status: Open
Type: Bug
Package: *Regular Expressions
Operating System: macOS Mojave 10.14.6
PHP Version: 7.4.2
Block user comment: N
Private report: N
New Comment:
Might be related to bug #79175.
Previous Comments:
------------------------------------------------------------------------
[2020-02-06 03:55:58] yahiru1121 at gmail dot com
Description:
------------
Combining unicode property codes with supported scripts produces unexpected results
Test script:
---------------
<?php
$str = 'aAï½ï¼¡äºãã¢ï½±1ï¼â
°Ê°';
$regs = [
'/[\p{Nd}\p{Han}]/u',
'/[\p{Nl}\p{Han}]/u',
'/[\p{Lu}\p{Han}]/u',
'/[\p{Ll}\p{Han}]/u',
'/[\p{Lo}\p{Han}]/u',
'/[\p{Lm}\p{Han}]/u',
];
foreach ($regs as $reg) {
echo $reg, ' => ', preg_replace($reg, 'xï¸', $str), PHP_EOL;
}
Expected result:
----------------
/[\p{Nd}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±xï¸xï¸â
°Ê°
/[\p{Nl}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±1ï¼xï¸Ê°
/[\p{Lu}\p{Han}]/u => axï¸ï½xï¸xï¸ãã¢ï½±1ï¼â
°Ê°
/[\p{Ll}\p{Han}]/u => xï¸Axï¸ï¼¡xï¸ãã¢ï½±1ï¼â
°Ê°
/[\p{Lo}\p{Han}]/u => aAï½ï¼¡xï¸xï¸xï¸xï¸1ï¼â
°Ê°
/[\p{Lm}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±1ï¼â
°xï¸
Actual result:
--------------
/[\p{Nd}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±1ï¼â
°Ê°
/[\p{Nl}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±1ï¼â
°Ê°
/[\p{Lu}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±xï¸xï¸â
°Ê°
/[\p{Ll}\p{Han}]/u => axï¸ï½xï¸xï¸ãã¢ï½±1ï¼â
°Ê°
/[\p{Lo}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±1ï¼â
°Ê°
/[\p{Lm}\p{Han}]/u => aAï½ï¼¡xï¸ãã¢ï½±1ï¼â
°Ê°
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79233&edit=1