Req #35950 [Asn->Csd]: Integer conversion and hex values
| From: | nikic@php.net | Date: | Sun, 08 Feb 2015 10:22:03 +0000 |
| Subject: | Req #35950 [Asn->Csd]: Integer conversion and hex values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190527@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=35950&edit=1
ID: 35950
Updated by: nikic@php.net
Reported by: tomas_matousek at hotmail dot com
Summary: Integer conversion and hex values
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: *General Issues
Operating System: *
PHP Version: *
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Fixed in PHP 7, by removing hex-string support in the cases where it existed.
Previous Comments:
------------------------------------------------------------------------
[2015-01-09 00:02:45] ajf@php.net
This would be fixed by this RFC (it removes hex support): https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings
------------------------------------------------------------------------
[2006-01-09 20:37:41] tomas_matousek at hotmail dot com
int(17) should be there, of course.
------------------------------------------------------------------------
[2006-01-09 20:36:46] tomas_matousek at hotmail dot com
Description:
------------
Why is (int) conversion ignoring hexadecimals if all other operation using integer conversions
convert them?
I think (int) conversion should also convert hexadecimals to be consistent with others.
Reproduce code:
---------------
$a = "0x10";
var_dump((int)$a,$a * 1,$a == "16");
Expected result:
----------------
int(16)
int(16)
int(17)
bool(true)
Actual result:
--------------
int(0)
int(16)
int(17)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=35950&edit=1