#45967 [NEW]: substr() return value is poorly documented

From: Date: Tue, 02 Sep 2008 03:07:25 +0000
Subject: #45967 [NEW]: substr() return value is poorly documented
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1138@lists.php.net to get a copy of this message
From: mike at silverorange dot com Operating system: Irrelevant PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: substr() return value is poorly documented 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 -- Edit bug report at http://bugs.php.net/?id=45967&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45967&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45967&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45967&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45967&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45967&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45967&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45967&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45967&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45967&r=support Expected behavior: http://bugs.php.net/fix.php?id=45967&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45967&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45967&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45967&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45967&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45967&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45967&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45967&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45967&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45967&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45967&r=mysqlcfg

« previous php.doc.bugs (#1138) next »