#34113 [NEW]: mb_ereg_replace does not function as it should under "UTF-8"

From: Date: Fri, 12 Aug 2005 23:15:18 +0000
Subject: #34113 [NEW]: mb_ereg_replace does not function as it should under "UTF-8"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-83501@lists.php.net to get a copy of this message
From: mlmlml at lily dot freemail dot ne dot jp Operating system: windows 2000 server PHP version: 4.3.11 PHP Bug Type: mbstring related Bug description: mb_ereg_replace does not function as it should under "UTF-8" Description: ------------ When "mb_ereg_replace" is used under "UTF-8" source environment, it does not seem to recognize gmulti-byte spaceh (zenkaku-space in Japanese). The same code runs correctly under gEUC-JPh source environment, so I supposed this was something buggy rather than mis-usage of the function. [mbstring] mbstring.language = Japanese mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.http_output = UTF-8 ;mbstring.encoding_translation = Off mbstring.detect_order = auto mbstring.substitute_character = none; ;mbstring.func_overload = 0 Reproduce code: --------------- <?php /* the all three var_dump()s "UTF-8", and this verifies the source is actually run under "UTF-8" */ var_dump(mb_regex_encoding()); var_dump(mb_internal_encoding()); mb_regex_encoding(mb_internal_encoding()); var_dump(mb_regex_encoding()); /* Although this var_dump should give "**********@*****" by recognising "@"(multi-byte space), when it is run under "UTF-8", it gives "****************". This assures that the "multi-byte space" is not recognised as it should. */ $string = "multi-byte@space"; var_dump(mb_ereg_replace('[^@]', '*', $string)); ?> Expected result: ---------------- multi-byte space should not be converted to "*" in the reproduce code since the regular expression is "[^@]". Actual result: -------------- multi-byte space is ignored and converted to "*". -- Edit bug report at http://bugs.php.net/?id=34113&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34113&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34113&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34113&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34113&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34113&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34113&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34113&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34113&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34113&r=support Expected behavior: http://bugs.php.net/fix.php?id=34113&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34113&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34113&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34113&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34113&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34113&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34113&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34113&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34113&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34113&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34113&r=mysqlcfg

« previous php.bugs (#83501) next »