[php-src] Issue #8924: `mb_str_split` must return one empty element for empty string
| From: | mvorisek | Date: | Tue, 05 Jul 2022 12:20:05 +0000 |
| Subject: | [php-src] Issue #8924: `mb_str_split` must return one empty element for empty string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241859@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8924
Author: mvorisek
### Description
The following code:
```php
<?php
print_r(str_split('', 1));
print_r(mb_str_split('', 1));
print_r(explode('-', ''));
print_r(preg_split('~-~', ''));
```
https://3v4l.org/CjiKl
Resulted in but I expected this output instead:
```diff
Array
(
[0] =>
)
Array
(
+ [0] =>
)
Array
(
[0] =>
)
Array
(
[0] =>
)
```
I belive this is inconsistency that should be fixed.
The original RFC https://wiki.php.net/rfc/mb_str_split did not cover
this case explicitly.
### PHP Version
PHP 7.4 - master
### Operating System
any