|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55241 return proper FALSE value when mb_substr parameters are not computable
Submitted: 2011-07-19 11:59 UTC Modified: 2011-07-22 04:41 UTC
From: netmosfera at gmail dot com Assigned:
Status: Not a bug Package: mbstring related
PHP Version: 5.4.0alpha2 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: netmosfera at gmail dot com
New email:
PHP Version: OS:


 [2011-07-19 11:59 UTC] netmosfera at gmail dot com
hi, it is possible to make mb_substr work exactly like substr?

substr("",0,10) // returns false
mb_substr("",0,10) // returns ""

substr("abc",7,1) // returns false
mb_substr("abc",7,1) // returns ""

thank you


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-20 05:11 UTC] lonnyk at gmail dot com
This was taken care of in

If you turn on mbstring.func_overload mb_substr will return false. Otherwise it 
returns ""
 [2011-07-20 05:12 UTC] lonnyk at gmail dot com
Bug #28899 was committed in Rev.#203546
 [2011-07-20 05:24 UTC] netmosfera at gmail dot com
yes but no one uses mbstring overload
in plus it is nearly-always not available on hosts, because it can't be enabled per-dir (read:
so i think this should be fixed
 [2011-07-22 04:41 UTC]
-Status: Open +Status: Bogus
 [2011-07-22 04:41 UTC]
Works as designed. The fact substr and mb_substr do not have the same behavior does not mean one of the is wrong. Besides, there would be compatibility issues in changing the behavior of one of them.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 12:01:28 2024 UTC