Bug #69433 [Opn]: function mb_split incorrectly parsing multibyte strings with mbregex
| From: | pffycloud at gmail dot com | Date: | Sun, 12 Apr 2015 22:34:33 +0000 |
| Subject: | Bug #69433 [Opn]: function mb_split incorrectly parsing multibyte strings with mbregex | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192005@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69433&edit=1
ID: 69433
User updated by: pffycloud at gmail dot com
Reported by: pffycloud at gmail dot com
Summary: function mb_split incorrectly parsing multibyte
strings with mbregex
Status: Open
Type: Bug
Package: *General Issues
-Operating System: Mac OS X
+Operating System: Mac OS X 10.10 Yosemite
PHP Version: 5.6.7
Block user comment: N
Private report: N
New Comment:
Added Mac OS X 10.10 Yosemite to 'OS' for clarity.
Previous Comments:
------------------------------------------------------------------------
[2015-04-12 22:33:07] pffycloud at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=69433&edit=1