php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #45967 substr() return value is poorly documented
Submitted: 2008-09-02 03:07 UTC Modified: 2008-11-05 09:00 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: mike at silverorange dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2008-09-02 03:07 UTC] mike at silverorange dot com
Description:
------------
Neither the documentation for $start nor the return values section mention that the function may return FALSE.

The documentation for $length does mention returning FALSE. Since $length is an optional parameter and doesn't really affect whether or not the function returns FALSE, it is not an intuitive place for the documentation

I suggest:

1.) Moving the following line from the $length parameter documentation to the $start parameter documentation:

"If $string is less than or equal to $start characters long, FALSE  will be returned."

2.) Altering the return documentation to read:

"Returns the extracted part of string. If $string is less than or equal to $start characters long, FALSE will be returned."

See also http://bugs.php.net/bug.php?id=20695&edit=2


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-05 09:00 UTC] vrana@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-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 14:00:01 2026 UTC