|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71971 mb_substr maybe returns false depending on mbstring.func_overload
Submitted: 2016-04-06 01:48 UTC Modified: 2016-04-13 09:49 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: taylor at defuse dot ca Assigned:
Status: Not a bug Package: mbstring related
PHP Version: 7.0.5 OS: Arch Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
14 - 4 = ?
Subscribe to this entry?

 [2016-04-06 01:48 UTC] taylor at defuse dot ca
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:
$result = mb_substr('abc', 5, 2);

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:



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-13 09:49 UTC]
-Status: Open +Status: Not a bug
 [2016-04-13 09:49 UTC]
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.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC