From: me at andr dot biz Operating system: freebsd 6.1 PHP version: 4.4.4 PHP Bug Type: PCRE related Bug description: preg_match returns wrong positions of matched substrings when UTF-8 is used
Description: ------------ /*Guys! Your bugtracking software hase problems with cyrillic symbols. I encoded all my words in example into HTML-entities. Please decode them to UTF-8 before reproducing */ It processes UTF-8 strings incorrectly. Firstly, please see the article:http://www.phpwact.org/php/i18n/utf-8 This article has so many described PHP bugst related to UTF-8. I think that ALL theese bugs must be fixed ASAP. Reproduce code: --------------- <pre> <?php if (!setlocale(LC_ALL,"ru_RU.UTF-8")) die('error'); $textUtf8 = "привет андрей"; preg_match('/андрей/u', $textUtf8, $matches, PREG_OFFSET_CAPTURE); print_r($matches); ?> </pre> Expected result: ---------------- Array ( [0] => Array ( [0] => андрей [1] => 7 ) ) Actual result: -------------- Array ( [0] => Array ( [0] => андрей [1] => 13 ) ) -- Edit bug report at http://bugs.php.net/?id=38860&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38860&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38860&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38860&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38860&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38860&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38860&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38860&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38860&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38860&r=support Expected behavior: http://bugs.php.net/fix.php?id=38860&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38860&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38860&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38860&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38860&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38860&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38860&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38860&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38860&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38860&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38860&r=mysqlcfg
