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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: netmosfera at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 22:01:28 2024 UTC