Edit report at https://bugs.php.net/bug.php?id=52950&edit=1
ID: 52950 Comment by: cmbecker69 at gmx dot de Reported by: confik at gmail dot com Summary: Wrong implicit conversion of strings containing hexadecimal numbers to int Status: Open Type: Bug Package: Scripting Engine problem Operating System: Linux 2.6.32 Ubuntu 10.04/i686 PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: IMO the behavior of the implicit type juggling is correct, and the result of the explicit type cast is erroneous in this regard. Anyway, both results should match. Previous Comments: ------------------------------------------------------------------------ [2010-09-29 10:49:25] confik at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=52950&edit=1