Bug #79233 [NEW]: Unicode character properties not working properly
| From: | yahiru1121 at gmail dot com | Date: | Thu, 06 Feb 2020 03:55:58 +0000 |
| Subject: | Bug #79233 [NEW]: Unicode character properties not working properly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-225379@lists.php.net to get a copy of this message | ||
From: yahiru1121 at gmail dot com
Operating system: macOS Mojave 10.14.6
PHP version: 7.4.2
Package: *Regular Expressions
Bug Type: Bug
Bug description:Unicode character properties not working properly
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 bug report at https://bugs.php.net/bug.php?id=79233&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79233&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79233&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79233&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79233&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79233&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79233&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79233&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79233&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79233&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79233&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79233&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79233&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79233&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79233&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79233&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79233&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79233&r=mysqlcfg