php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60795 strpos() paragraph is misleading
Submitted: 2012-01-18 22:28 UTC Modified: 2012-01-21 22:16 UTC
From: ben at bravenet dot com Assigned: frozenfire (profile)
Status: Closed 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: ben at bravenet dot com
New email:
PHP Version: OS:

 

 [2012-01-18 22:28 UTC] ben at bravenet dot com
Description:
------------
---
From manual page: http://www.php.net/function.strpos#refsect1-function.strpos-returnvalues
---

In the docs it says: 

--
This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE, such as 0 or "". Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.
--

This should be rewritten to something less ambiguous because an empty string can never be returned by this function.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-18 22:44 UTC] danielc at analysisandsolutions dot com
Perhaps something like: "This function can return FALSE or 0.  Both evaluate to the same thing when using ==."
 [2012-01-18 22:50 UTC] jam at zoidtechnologies dot com
All that needs to be done is to remove the "...such as 0 or """ from the end of the "warning", and it will be much less misleading.
 [2012-01-18 23:40 UTC] anon at anon dot anon
"This function may return Boolean FALSE, but may also return 0, which evaluates to FALSE when compared with the == operator. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function."
 [2012-01-21 22:16 UTC] frozenfire@php.net
Automatic comment from SVN on behalf of frozenfire
Revision: http://svn.php.net/viewvc/?view=revision&revision=322548
Log: Generalized &return.falseproblem; to reduce confusion, by removing the examples of which values evaluate to false. Closes bug #60795.
 [2012-01-21 22:16 UTC] frozenfire@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: frozenfire
 [2012-01-21 22:16 UTC] frozenfire@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: Thu Oct 08 13:00:02 2026 UTC