Req #52631 [Opn->Wfx]: substr() returns unexpectedly false
| From: | aharvey@php.net | Date: | Wed, 18 Aug 2010 02:57:21 +0000 |
| Subject: | Req #52631 [Opn->Wfx]: substr() returns unexpectedly false | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4877@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52631&edit=1
ID: 52631
Updated by: aharvey@php.net
Reported by: david at grudl dot com
Summary: substr() returns unexpectedly false
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Documentation problem
PHP Version: Irrelevant
Block user comment: N
New Comment:
The substr() manual page already says in the return values section that
FALSE is returned on failure. I'm not sure how much clearer that can be.
Previous Comments:
------------------------------------------------------------------------
[2010-08-17 22:45:44] david at grudl dot com
Description:
------------
substr($s, 0, ...) is the usual way programmers shorten strings. And
substr sometimes returns string, sometimes boolean (see #52628). So
developers are forced to use (string) substr($s, 0, ...) everywhere. It
should be emphatically stated in the documentation.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52631&edit=1