Bug #54506 [NEW]: Regex Unicode problem
| From: | chsavio at gmail dot com | Date: | Mon, 11 Apr 2011 14:39:27 +0000 |
| Subject: | Bug #54506 [NEW]: Regex Unicode problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160093@lists.php.net to get a copy of this message | ||
From:
Operating system: Centos 2.6.18
PHP version: 5.3SVN-2011-04-08 (snap)
Package: PCRE related
Bug Type: Bug
Bug description:Regex Unicode problem
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 bug report at http://bugs.php.net/bug.php?id=54506&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54506&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54506&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54506&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54506&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54506&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54506&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54506&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54506&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54506&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54506&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54506&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54506&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54506&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54506&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54506&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54506&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54506&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54506&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54506&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54506&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54506&r=mysqlcfg