Bug #69433 [NEW]: function mb_split incorrectly parsing multibyte strings with mbregex

From: Date: Sun, 12 Apr 2015 22:33:07 +0000
Subject: Bug #69433 [NEW]: function mb_split incorrectly parsing multibyte strings with mbregex
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192004@lists.php.net to get a copy of this message
From: pffycloud at gmail dot com Operating system: Mac OS X PHP version: 5.6.7 Package: *General Issues Bug Type: Bug Bug description:function mb_split incorrectly parsing multibyte strings with mbregex Description: ------------ The multibyte split function (function.mb_split) does not appear to be working as expected. Instead of parsing and converting the multibyte string into array elements as specified, the character elements are being split at unpredictable positions, yielding unpredictable array elements. The "Test script" demonstrates an expected result for the first multibyte string, but then shows unexpected results for the next two multibyte strings. Thank you for reviewing this potential bug. Test script: --------------- <?php header('Content-Type: text/html; charset=UTF-8'); mb_regex_encoding('UTF-8'); mb_internal_encoding('UTF-8'); $arr = mb_split('\B', "你好"); # Array ( [0] => 你 [1] => 好 ) ## Okay! print_r($arr); $arr = mb_split('\B', "你你"); # Array ( [0] => 你 [1] => 你 ) ## Expected Result print_r($arr); ## Instead, this message appears: ## Warning: mb_split(): mbregex search failure in mbsplit(): ## no support in this configuration in /dir/foo.php on line 22 $arr = mb_split('\B', '隨著劇情的推進'); print_r($arr); # Expected Result # Array ( [0] => 隨 [1] => 著 [2] => 劇 [3] => 情 [4] => 的 [5] => 推 [6] => 進 ) # Actual Result, NOT expected # Array ( [0] => 隨 [1] => � [2] => �劇 [3] => � [4] => �的 [5] => � [6] => �進 ) -- Edit bug report at https://bugs.php.net/bug.php?id=69433&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69433&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69433&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69433&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69433&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69433&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69433&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69433&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69433&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69433&r=support Expected behavior: https://bugs.php.net/fix.php?id=69433&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69433&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69433&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69433&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69433&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69433&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69433&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69433&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69433&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69433&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69433&r=mysqlcfg

« previous php.bugs (#192004) next »