Edit report at https://bugs.php.net/bug.php?id=65212&edit=1
ID: 65212
Comment by: iam4webwork at hotmail dot com
Reported by: iam4webwork at hotmail dot com
Summary: problem if pass in numeric string containing a float
between 0 and 1
Status: Open
Type: Bug
Package: Math related
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
_php_math_basetozval appears to be source of problem b/c while it mimics
strtol,
unlike strtol it fails to adequately deal with '.' being an illegal character.
strtol disregards '.' and all subsequent input whereas _php_math_basetozval
just
skips the '.' and processes the next character.
Previous Comments:
------------------------------------------------------------------------
[2013-07-06 08:59:10] iam4webwork at hotmail dot com
Description:
------------
If you pass to base_convert a numeric string like "0.5", to have it converted
from base 10 to base 16, PHP will interpret the input as decimal 5 and return
hexadecimal 5. I suspect that the problem lies internally in the logic of
_php_math_basetozval.
Test script:
---------------
var_dump(base_convert("0.5",10,16));
Expected result:
----------------
I expected PHP to return a zero just as printf("%x","0.5") and dexhex() do.
Actual result:
--------------
5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65212&edit=1