|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78190 mb_split now return false with ISO strings
Submitted: 2019-06-20 15:09 UTC Modified: 2020-08-16 09:09 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mvachette at adequasys dot com Assigned:
Status: Re-Opened Package: mbstring related
PHP Version: 7.2.19 OS: Windows 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mvachette at adequasys dot com
New email:
PHP Version: OS:


 [2019-06-20 15:09 UTC] mvachette at adequasys dot com
It seems that something changes in 7.2.18 when using mb_split on ISO string.

On at least 7.2.16 & 7.2.17, using this function with ISO encoding string containing accents works fine.

On a new env with version 7.2.18, the same code now return "false" (new undocumented behaviour)

Test script:
var_dump(mb_split('-', 'e-a'));
//works fine on any version

var_dump(mb_split('-', 'é-a'));
// works if string is UTF8 encoded
// return "false" with an ISO encoded string on PHP 7.2.18


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-20 15:15 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: sjon
 [2019-06-20 15:15 UTC]
I cannot reproduce this, it seems to work pretty consistently:
 [2019-06-20 15:21 UTC]
-Status: Feedback +Status: Not a bug
 [2019-06-20 15:21 UTC]
The default encoding is UTF-8, use mb_regex_encoding() if you are working with something else.
 [2019-06-20 15:30 UTC] mvachette at adequasys dot com
Ok, I figure to clear the error using mb_regex_encoding, thanks for the suggestion.

But is there any documentation available about this change of behaviour? For information, I found this burried into Smarty lib. I can ensure correct behaviour of mb_split on my app, by maybe I will not be the lone to be impacted.
 [2019-06-20 15:47 UTC]
-Status: Not a bug +Status: Re-Opened -Type: Bug +Type: Documentation Problem
 [2019-06-20 15:47 UTC]
Right, this should probably be documented. This change was backported in which is in 7.1.28, 7.2.18 and 7.3.5. For other mb_regex functions apart from mb_split and mb_ereg_match this was already checked previously, though I'm not sure since when.
 [2020-08-16 09:09 UTC]
-Assigned To: sjon +Assigned To:
 [2022-12-27 11:20 UTC] Isaac1866Williams at gmail dot com

In the case of failure to perform preg_split due to invalid inputs, preg_split will return false.

$string = array("sdasds"); // Invalid string
var_dump($array); //false

$string = "sdasds";
$array=preg_split('j',$string); // Invalid pattern
var_dump($array); //false

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 12:01:29 2024 UTC