php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70177 Undecumented changes in mb_substr behavior
Submitted: 2015-07-31 16:08 UTC Modified: 2015-07-31 17:11 UTC
From: teo8976 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: mbstring related
PHP Version: Irrelevant OS: all
Private report: No CVE-ID: None
 [2015-07-31 16:08 UTC] teo8976 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.mb-substr
---

Check this:
http://3v4l.org/e1Pc4

1) The behavior of mb_substr with a negative value as first parameter is completely undocumented. (except for a user's comment)

As expected, it matches that of substr, using the negative value as a starting character counting from the end of the string, but it needs to be documented.


2) The behavior with a negative value as the first parameter and NULL as the second changes at version 5.4.8
Starting from that version, it behaves as expected (taking the string to its end); previous to that version it returns an empty string.
The behavior in older versions was obviously a bug, but the change should be documented.

Also, if there's a value to be used instead of NULL as a workaround, that needs to be documented too.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-31 17:10 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=337268
Log: fixed documentation wrt. $start and $length parameters (fixes #70177)
 [2015-07-31 17:11 UTC] cmb@php.net
-Status: Open +Status: Closed -Package: Documentation problem +Package: mbstring related -Assigned To: +Assigned To: cmb
 [2015-07-31 17:11 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC