Bug #67439 [Opn->Nab]: php 64-bit treats not so large integer literals as doubles
| From: | aharvey@php.net | Date: | Fri, 13 Jun 2014 17:16:48 +0000 |
| Subject: | Bug #67439 [Opn->Nab]: php 64-bit treats not so large integer literals as doubles | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186185@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67439&edit=1
ID: 67439
Updated by: aharvey@php.net
Reported by: yuri dot kanivetsky at gmail dot com
Summary: php 64-bit treats not so large integer literals as
doubles
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: windows 8 64-bit
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
PHP uses the long type for integers, and on Windows that's always a 32 bit integer, even on a
64 bit build.
Previous Comments:
------------------------------------------------------------------------
[2014-06-13 15:04:33] yuri dot kanivetsky at gmail dot com
Description:
------------
I'm using php-5.5.13. This bug makes json_encode generate wrong output, when values are high
enough (they are represented in scientific notation, like 1.00001279446E+14). Also, it makes
json_decode generate values of wrong data type, when large integers are encountered. The output on
debian squeeze with php-5.4.10 is as expected.
Test script:
---------------
<?php
$v = 2147483647;
echo $v . " - " . gettype($v) . "\n";
$v = 2147483648;
echo $v . " - " . gettype($v) . "\n";
Expected result:
----------------
2147483647 - integer
2147483648 - integer
Actual result:
--------------
2147483647 - integer
2147483648 - double
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67439&edit=1