#45479 [NEW]: wrong result when using preg_replace with /u and ungreedy *?

From: Date: Thu, 10 Jul 2008 16:53:13 +0000
Subject: #45479 [NEW]: wrong result when using preg_replace with /u and ungreedy *?
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126443@lists.php.net to get a copy of this message
From: michael dot virnstein at brodos dot de Operating system: Linux PHP version: 5.2.6 PHP Bug Type: PCRE related Bug description: wrong result when using preg_replace with /u and ungreedy *? Description: ------------ When i use preg_replace with the /u utf-8 modifier and an ungreedy search e.g. with *?, the result is different to a call without /u. Reproduce code: --------------- <?php echo "without /u:". preg_replace('/^[^d]*?(d)?$/', '\\1', 'abc'); echo "<br>"; echo "with /u: ".preg_replace('/^[^d]*?(d)?$/u', '\\1', 'abc'); ?> Expected result: ---------------- without /u: with /u: Actual result: -------------- without /u: with /u: abc -- Edit bug report at http://bugs.php.net/?id=45479&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45479&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45479&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45479&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45479&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45479&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45479&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45479&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45479&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45479&r=support Expected behavior: http://bugs.php.net/fix.php?id=45479&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45479&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45479&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45479&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45479&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45479&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45479&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45479&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45479&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45479&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45479&r=mysqlcfg

« previous php.bugs (#126443) next »