php.net |  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
Votes:1
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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: taylor at defuse dot ca
New email:
PHP Version: OS:

 

 [2016-04-06 01:48 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-13 09:49 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2016-04-13 09:49 UTC] ab@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 02:01:28 2024 UTC