Bug #66399 [PATCH]: Inconsistent runtime support for integer binary/hex syntax
| From: | krakjoe@php.net | Date: | Fri, 03 Jan 2014 14:15:09 +0000 |
| Subject: | Bug #66399 [PATCH]: Inconsistent runtime support for integer binary/hex syntax | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183562@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66399&edit=1
ID: 66399
Patch added by: krakjoe@php.net
Reported by: benjamin at zikarsky dot de
Summary: Inconsistent runtime support for integer binary/hex
syntax
Status: Assigned
Type: Bug
Package: Strings related
PHP Version: 5.5.7
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: inconsistent-bin-hex-handling.patch
Revision: 1388758509
URL: https://bugs.php.net/patch-display.php?bug=66399&patch=inconsistent-bin-hex-handling.patch&revision=1388758509
Previous Comments:
------------------------------------------------------------------------
[2014-01-03 14:13:18] krakjoe@php.net
The following patch has been added/updated:
Patch Name: inconsistent-bin-hex-handling.patch
Revision: 1388758398
URL: https://bugs.php.net/patch-display.php?bug=66399&patch=inconsistent-bin-hex-handling.patch&revision=1388758398
------------------------------------------------------------------------
[2014-01-03 13:52:38] krakjoe@php.net
Dmitry, assigning to you to get some attention, this appears quite important to me. I'm not
able to say if the patch has adverse performance impact or introduces some strangeness you purposely
left out.
It looks good to me ?
------------------------------------------------------------------------
[2014-01-03 13:42:59] krakjoe@php.net
All Zend and ext/standard/string tests passing ...
------------------------------------------------------------------------
[2014-01-03 13:41:17] krakjoe@php.net
Patch attached ... while this has the desired outcome, I've not tested and don't know if
it introduces inconsistencies elsewhere.
I would assume there is some non-obvious reason this wasn't done in the first place ?
<?php
$bin = "0b100";
$hex = "0x04";
var_dump((int) $bin, (int) $hex);
var_dump((double) $bin, (double) $hex);
var_dump(is_numeric($bin));
var_dump(is_numeric($hex));
var_dump(intval($bin), intval($hex));
var_dump(floatval($bin), floatval($hex));
Yields:
int(4)
int(4)
float(4)
float(4)
bool(true)
bool(true)
int(4)
int(4)
float(4)
float(4)
------------------------------------------------------------------------
[2014-01-03 13:39:44] krakjoe@php.net
The following patch has been added/updated:
Patch Name: inconsistent-bin-hex-handling.patch
Revision: 1388756384
URL: https://bugs.php.net/patch-display.php?bug=66399&patch=inconsistent-bin-hex-handling.patch&revision=1388756384
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=66399
--
Edit this bug report at https://bugs.php.net/bug.php?id=66399&edit=1