php.net |  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
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:
MUST BE VALID
Solve the problem:
28 + 9 = ?
Subscribe to this entry?

 
 [2011-07-19 11:59 UTC] netmosfera at gmail dot com
Description:
------------
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-20 05:11 UTC] lonnyk at gmail dot com
This was taken care of in https://bugs.php.net/bug.php?id=28899

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: https://bugs.php.net/bug.php?id=51415)
so i think this should be fixed
 [2011-07-22 04:41 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2011-07-22 04:41 UTC] cataphract@php.net
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-2022 The PHP Group
All rights reserved.
Last updated: Sat Jul 02 21:05:46 2022 UTC