#41588 [NEW]: preg_match offset is in bytes even in unicode mode

From: Date: Mon, 04 Jun 2007 13:04:43 +0000
Subject: #41588 [NEW]: preg_match offset is in bytes even in unicode mode
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113354@lists.php.net to get a copy of this message
From: spam02 at pornel dot net Operating system: * PHP version: 4CVS-2007-06-04 (snap) PHP Bug Type: PCRE related Bug description: preg_match offset is in bytes even in unicode mode Description: ------------ preg_match() with 'u' modifier is supposed to use UTF-8, but this switch doesn't affect offset parameter, which is always in bytes. This gotcha at least deserves to be documented, although consistent unicode support would be even better. Reproduce code: --------------- <?php preg_match('/./u',urldecode('%C2%AE').'NY',$m,NULL,2); echo $m[0]; Expected result: ---------------- Y Actual result: -------------- N -- Edit bug report at http://bugs.php.net/?id=41588&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41588&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41588&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41588&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41588&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41588&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41588&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41588&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41588&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41588&r=support Expected behavior: http://bugs.php.net/fix.php?id=41588&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41588&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41588&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41588&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41588&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41588&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41588&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41588&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41588&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41588&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41588&r=mysqlcfg

« previous php.bugs (#113354) next »