Bug #54506 [Bgs]: Regex Unicode problem
Edit report at http://bugs.php.net/bug.php?id=54506&edit=1
ID: 54506
User updated by: chsavio at gmail dot com
Reported by: chsavio at gmail dot com
Summary: Regex Unicode problem
Status: Bogus
Type: Bug
Package: PCRE related
Operating System: Centos 2.6.18
PHP Version: 5.3SVN-2011-04-08 (snap)
Block user comment: N
Private report: N
New Comment:
Missed the PCRE modifiers section of the documentation. Sorry about
that. Thanks for your time.
Previous Comments:
------------------------------------------------------------------------
[2011-04-11 16:52:23] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Use the /u modifier.
------------------------------------------------------------------------
[2011-04-11 16:39:27] chsavio at gmail dot com
Description:
------------
Combinations of unicode characters in brackets appear to match a
completely incorrect character. We're using PHP 5.3.3 (cli). And I was
able to reproduce the problem on a PHP regex test site.
http://www.pagecolumn.com/tool/pregtest.htm
Test script:
---------------
http://www.pagecolumn.com/tool/pregtest.htm
<?php
$ptn = "/[ß]/";
$str = "ø";
preg_match($ptn, $str, $matches);
print_r($matches);
?>
Should be the equivalent of the following, but is not
<?php
$ptn = "/Ã|Ÿ/";
$str = "ø";
preg_match($ptn, $str, $matches);
print_r($matches);
?>
Expected result:
----------------
I'd expect no matches.
Array
(
)
Actual result:
--------------
I get a match.
Array
(
[0] => ø
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54506&edit=1
Thread (3 messages)