#41588 [Opn]: preg_match offset is in bytes even in unicode mode
| From: | spam02 at pornel dot net | Date: | Mon, 04 Jun 2007 13:08:03 +0000 |
| Subject: | #41588 [Opn]: preg_match offset is in bytes even in unicode mode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113355@lists.php.net to get a copy of this message | ||
ID: 41588
User updated by: spam02 at pornel dot net
Reported By: spam02 at pornel dot net
Status: Open
Bug Type: PCRE related
Operating System: *
-PHP Version: 4CVS-2007-06-04 (snap)
+PHP Version: 6.0.0-dev (20070509)
New Comment:
(fixed php version)
Previous Comments:
------------------------------------------------------------------------
[2007-06-04 13:04:43] spam02 at pornel dot net
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 this bug report at http://bugs.php.net/?id=41588&edit=1