From: Operating system: Linux 2.6.32 Ubuntu 10.04/i686 PHP version: 5.3.3 Package: Strings related Bug Type: Bug Bug description:Wrong implicit conversion of strings containing hexadecimal numbers to int
Description: ------------ If string contains hexadecimal number, such as '0x05' it correctly explicitly casts to integer(resulting zero): php > var_dump((int) '0x05'); int(0) but incorrectly casts implicitly (resulting its value, 5) php > var_dump(1 * '0x05'); int(5) Same for floats: php > var_dump((float) '0xffffffffff'); float(0) php > var_dump(1 * '0xffffffffff'); float(1099511627775) P.S.: Tests were made on x86 (i686) Linux machine. Test script: --------------- <?php var_dump(1 * '0x05'); var_dump(1 * '0xffffffffff'); Expected result: ---------------- int(0) float(0) Actual result: -------------- int(5) float(1099511627775) -- Edit bug report at http://bugs.php.net/bug.php?id=52950&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52950&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52950&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52950&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52950&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52950&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52950&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52950&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52950&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52950&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52950&r=support Expected behavior: http://bugs.php.net/fix.php?id=52950&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52950&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52950&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52950&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52950&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52950&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52950&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52950&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52950&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52950&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52950&r=mysqlcfg
