Bug #10678: distinction between false and "0" (string)
| From: | ms at marcant dot net | Date: | Fri, 04 May 2001 23:21:26 +0000 |
| Subject: | Bug #10678: distinction between false and "0" (string) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-53970@lists.php.net to get a copy of this message | ||
From: ms@marcant.net
Operating system:
PHP version: 4.0.4pl1
PHP Bug Type: *General Issues
Bug description: distinction between false and "0" (string)
There is a subtle problem with functions returning 'false' as
an return status indication.
Take for example strstr(haystack, needle).
The function returns 'false' to indicate that <needle> could not
be found in <haystack> or returns the substring of haystack
starting with <needle>
With certain strings the above assertion is not true with php:
$haystack='1230';
if (strstr($haystack,"0")==false)
{ echo ' oh no.. '; }
--
Edit Bug report at: http://bugs.php.net/?id=10678&edit=1