ID: 49384
Updated by: [email protected]
Reported By: soham dot mehta at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: x86_64 GNU/Linux
PHP Version: 5.2.10
New Comment:
You should use double quotes instead. Now you're not matching vertical
tab but \v.
Previous Comments:
------------------------------------------------------------------------
[2009-08-27 09:53:50] soham dot mehta at gmail dot com
Description:
------------
In preg_match (and preg_replace), vertical tab character matches
characters other than itself. At the least, it matches ascii 10,11,12,13
and 133, when it should only match 11.
(Vertical tab has been nixed from PCRE - is that the cause?)
Reproduce code:
---------------
$wrong = chr(133); //can use any of 10,12,13 or 133
$x = preg_match('/\v/', $wrong, $matches,
PREG_OFFSET_CAPTURE);
var_dump($matches);
$right = chr(11);
$x = preg_match('/\v/', $right, $matches,
PREG_OFFSET_CAPTURE);
var_dump($matches);
Expected result:
----------------
array
empty
array
0 =>
array
0 => string '' (length=1)
1 => int 0
Actual result:
--------------
array
0 =>
array
0 => string '�' (length=1)
1 => int 0
array
0 =>
array
0 => string '' (length=1)
1 => int 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49384&edit=1