Bug #71971 [Opn->Nab]: mb_substr maybe returns false depending on mbstring.func_overload
| From: | ab@php.net | Date: | Wed, 13 Apr 2016 09:49:25 +0000 |
| Subject: | Bug #71971 [Opn->Nab]: mb_substr maybe returns false depending on mbstring.func_overload | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200520@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71971&edit=1
ID: 71971
Updated by: ab@php.net
Reported by: taylor at defuse dot ca
Summary: mb_substr maybe returns false depending on
mbstring.func_overload
-Status: Open
+Status: Not a bug
Type: Bug
Package: mbstring related
Operating System: Arch Linux
PHP Version: 7.0.5
Block user comment: N
Private report: N
New Comment:
Thanks for the report. This actually is the same as bug #55241, and you can walk further to bug
#28899 to see that this is intended behavior. The pure mb_* functions may have different behavior,
but once they do overload, the behavior should be the same as in the corresponding core functions.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2016-04-06 01:48:28] taylor at defuse dot ca
Description:
------------
When mbstring.func_overload=0, mb_substr returns "" when you call it with an out of bounds
range. This is consistent with the documentation. However, when mbstring.func_overload=7, mb_substr
returns boolean false. This is inconsistent with the documentation. I expect the behavior to be
consistent regardless of the value of mbstring.func_overload.
This is different from Bug #55241.
Test script:
---------------
<?php
$result = mb_substr('abc', 5, 2);
var_dump($result);
Expected result:
----------------
When mbstring.func_overload=0:
string(0) ""
When mbstring.func_overload=7:
string(0) ""
Actual result:
--------------
When mbstring.func_overload=0:
string(0) ""
When mbstring.func_overload=7:
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71971&edit=1