From: matt at raines dot me dot uk
Operating system: GNU/Linux 2.4.27
PHP version: 5.1.6
PHP Bug Type: Strings related
Bug description: strpos($needle, $integer) returns 0 for certain values of $integer

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 bug report at [url]http://bugs.php.net/?id=39278&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39278&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39278&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39278&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39278&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=39278&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=39278&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39278&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=39278&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=39278&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=39278&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=39278&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=39278&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=39278&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39278&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=39278&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=39278&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39278&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=39278&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39278&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39278&r=mysqlcfg[/url]