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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php dot maks3w at virtualplanets dot net
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 19:01:29 2024 UTC