From:
Operating system: Linux
PHP version: 5.3SVN-2011-01-23 (snap)
Package: Unicode Engine related
Bug Type: Bug
Bug description:preg_replace: * qualifier on unicode replace garbacles the
string
Description:
------------
When using the following test script to strip out all unicode except for
letters the string becomes garbled when the * qualifier is added, the only
surviving character that is intact is ú.
Also, if you add \pN to the exceptions it additionally preserves the ó.
Verified on 5.2,5.3 and 5.3-SNAP.
Test script:
---------------
echo preg_replace('/[^\pL\pM]*/iu', '', 'áéÃóú');
or
echo preg_replace('/[^\pL\pM\pN]*/iu', '', 'áéÃóú');
Expected result:
----------------
áéÃóú
Actual result:
--------------
����ú
or
���óú (if \pN is added to the exceptions).
--
Edit bug report at http://bugs.php.net/bug.php?id=53823&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53823&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53823&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53823&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53823&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53823&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53823&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53823&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53823&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53823&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53823&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53823&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53823&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53823&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53823&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53823&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53823&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53823&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53823&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53823&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53823&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53823&r=mysqlcfg