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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 05:01:27 2025 UTC