#42298 [NEW]: preg_match with /u gives different results for \S\S and \S{2}

From: Date: Tue, 14 Aug 2007 16:46:48 +0000
Subject: #42298 [NEW]: preg_match with /u gives different results for \S\S and \S{2}
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116054@lists.php.net to get a copy of this message
From: matthew-php at dracos dot co dot uk Operating system: Windows XP PHP version: 5CVS-2007-08-14 (snap) PHP Bug Type: PCRE related Bug description: preg_match with /u gives different results for \S\S and \S{2} Description: ------------ When using the /u modifier, preg_match, preg_match_all, and preg_replace all give incorrect results using /\S{2}/u but work fine with /\S\S/u which should be equivalent. Reproduce code: --------------- $s = "A\xc2\xa3BC"; preg_match_all('/\S\S/u', $s, $m); print_r($m[0]); preg_match_all('/\S{2}/u', $s, $m); print_r($m[0]); Expected result: ---------------- Array ( [0] => A£ [1] => BC ) Array ( [0] => A£ [1] => BC ) Actual result: -------------- Array ( [0] => A£ [1] => BC ) Array ( [0] => A [1] => ) -- Edit bug report at http://bugs.php.net/?id=42298&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42298&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42298&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42298&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42298&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42298&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42298&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42298&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42298&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42298&r=support Expected behavior: http://bugs.php.net/fix.php?id=42298&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42298&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42298&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42298&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42298&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42298&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42298&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42298&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42298&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42298&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42298&r=mysqlcfg

« previous php.bugs (#116054) next »