php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66219 Changes introduced in #62759 produces a BC Break
Submitted: 2013-12-02 18:27 UTC Modified: 2014-07-07 05:45 UTC
From: php dot maks3w at virtualplanets dot net Assigned: stas (profile)
Status: Not a bug Package: intl (PECL)
PHP Version: 5.4.22 OS:
Private report: No CVE-ID: None
 [2013-12-02 18:27 UTC] php dot maks3w at virtualplanets dot net
Description:
------------
Before PHP 5.4.18 and 5.5.1 a null or 0 value in the third argument returns the whole string from $start when $start is positive.

Test script:
---------------
$value = 'ˆCODE128:Š';
var_dump(grapheme_substr($value, 1));
var_dump(grapheme_substr($value, 1, null));
var_dump(grapheme_substr($value, 1, 0));

Expected result:
----------------
string(10) "CODE128:Š"
string(10) "CODE128:Š"
string(10) "CODE128:Š"

Actual result:
--------------
string(10) "CODE128:Š"
string(0) ""
string(0) ""

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-02 18:29 UTC] aharvey@php.net
-Package: ICONV related +Package: intl -Assigned To: +Assigned To: stas
 [2013-12-02 18:29 UTC] aharvey@php.net
Stas, since you made the original fix, do you have any thoughts on this? Is it expected behaviour that we should be documenting, or an unexpected side effect of the fix?
 [2014-07-07 05:45 UTC] stas@php.net
-Status: Assigned +Status: Not a bug
 [2014-07-07 05:45 UTC] stas@php.net
Looks like the actual behavior is correct - if you ask for the string of length 0, you get an empty string. Also matches the behavior of substr().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC