Doc #60795 [Com]: strpos() paragraph is misleading
| From: | anon at anon dot anon | Date: | Wed, 18 Jan 2012 23:40:13 +0000 |
| Subject: | Doc #60795 [Com]: strpos() paragraph is misleading | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7792@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60795&edit=1
ID: 60795
Comment by: anon at anon dot anon
Reported by: ben at bravenet dot com
Summary: strpos() paragraph is misleading
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
"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."
Previous Comments:
------------------------------------------------------------------------
[2012-01-18 22:50:51] 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 22:44:16] 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:28:18] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60795&edit=1