From: bugs dot php dot net at zetafleet dot com
Operating system: Win32; Cygwin x86
PHP version: 4.3.3
PHP Bug Type: Scripting Engine problem
Bug description: bin2hex compare with HEX value that equals DEC value of HEX of bin
returns true
Description:
------------
This is complicated, so I'll try explaining as best I can.
There is a binary file. The first byte is 0x44. Doing a comparison (==) to
0x2C returns "TRUE" because 44 is the decimal for 0x2C. The decimal value
of 0x44 is 68. This should return "FALSE" but does not.
Reproduce code:
---------------
(bin2hex("D") == 0x2C) RETURNS TRUE; SHOULD RETURN FALSE;
(bin2hex("D") == 0x44) RETURNS FALSE; SHOULD RETURN TRUE;
(bin2hex("D") == 44) RETURNS TRUE; SHOULD RETURN TRUE;
Expected result:
----------------
print(bin2hex("D") == 0x2C) //prints nothing
print(bin2hex("D") == 0x44) //prints '1'
print(bin2hex("D") == 44) //prints '1'
Actual result:
--------------
print(bin2hex("D") == 0x2C) //prints '1'
print(bin2hex("D") == 0x44) //prints nothing
print(bin2hex("D") == 44) //prints '1'
--
Edit bug report at http://bugs.php.net/?id=26702&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26702&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26702&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26702&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26702&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26702&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26702&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26702&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26702&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26702&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26702&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26702&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26702&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26702&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26702&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26702&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26702&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26702&r=float