php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #52631 substr() returns unexpectedly false
Submitted: 2010-08-17 22:45 UTC Modified: 2010-08-18 04:57 UTC
From: david at grudl dot com Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: david at grudl dot com
New email:
PHP Version: OS:

 

 [2010-08-17 22:45 UTC] 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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-18 04:57 UTC] aharvey@php.net
-Status: Open +Status: Wont fix
 [2010-08-18 04:57 UTC] aharvey@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 03:01:29 2024 UTC