ID: 39278
Updated by: [email]tony2001php.net[/email]
Reported By: matt at raines dot me dot uk
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: GNU/Linux 2.4.27
PHP Version: 5.1.6
New Comment:

If needle is not a string, it is converted to an integer and applied as
the ordinal value of a character.

Hint: chr(65) == 'A', chr(66) == 'B'


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

[2006-10-27 11:13:08] matt at raines dot me dot uk

Description:
------------
Searching for a string in an integer using strpos() returns integer 0
if (integer % 256) is the lowest ASCII value of any character in the
search string, or the highest ASCII value of any character minus 256.

Otherwise it returns boolean false as expected.

Reproduce code:
---------------
var_dump(strpos("A", 65));
var_dump(strpos("A", 66));
var_dump(strpos("B", 65));
var_dump(strpos("B", 66));


Expected result:
----------------
bool(false)
bool(false)
bool(false)
bool(false)

Actual result:
--------------
int(0)
bool(false)
bool(false)
int(0)


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


--
Edit this bug report at [url]http://bugs.php.net/?id=39278&edit=1[/url]