ID:               35041
 Updated by:       [EMAIL PROTECTED]
 Reported By:      john dot clements at publicinfo dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Windows xp pro sp2
 PHP Version:      5CVS-2005-10-31 (snap)
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

strpos doesn't return true on success but the position  


Previous Comments:
------------------------------------------------------------------------

[2005-11-01 00:12:28] john dot clements at publicinfo dot net

Description:
------------
This is a problem with === true and !== true whether used with strpos
or with array_search and presumably with other functions.

This also fails under PHP 4.3.10 on FreeBSD 4.8-STABLE,
but that is a hosted server and I can't upgrade it to test.

I have done further testing and found that 
checking for === false or !== false is OK:
=== false works when statement is true
=== false works when statement is false
=== true doesn't work when statement is true
=== true works when statement is false
!== true  doesn't work when statement is true
!== true  works when statement is false
!== false works when statement is true
!== false works when statement is false
Pls get in touch if you would like the code to show that. 


Reproduce code:
---------------
<?php

if (strpos("hey","h") === true) print "1. worked \n";
else print "1. didn't work\n";
if (strpos("hey","h") !== false) print "2. worked \n";
else print "2. didn't work\n";
?>


Expected result:
----------------
1. worked
2. worked


Actual result:
--------------
1. didn't work
2. worked



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35041&edit=1

Reply via email to