Bug #53823 [Opn]: preg_replace: * qualifier on unicode replace garbles the string

From: Date: Sun, 23 Jan 2011 17:04:49 +0000
Subject: Bug #53823 [Opn]: preg_replace: * qualifier on unicode replace garbles the string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158116@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53823&edit=1 ID: 53823 User updated by: keith at chaos-realm dot net Reported by: keith at chaos-realm dot net -Summary: preg_replace: * qualifier on unicode replace garbacles the string +Summary: preg_replace: * qualifier on unicode replace garbles the string Status: Open Type: Bug Package: Unicode Engine related Operating System: Linux PHP Version: 5.3SVN-2011-01-23 (snap) Block user comment: N Private report: N New Comment: . Previous Comments: ------------------------------------------------------------------------ [2011-01-23 18:00:57] keith at chaos-realm dot net 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 this bug report at http://bugs.php.net/bug.php?id=53823&edit=1

« previous php.bugs (#158116) next »