Bug #51274 [Opn->Fbk]: Integer overflow does not cast as float
| From: | aharvey@php.net | Date: | Fri, 26 Mar 2010 05:33:37 +0000 |
| Subject: | Bug #51274 [Opn->Fbk]: Integer overflow does not cast as float | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149038@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51274&edit=1
ID: 51274
Updated by: aharvey@php.net
Reported by: cduncan at regatta dot com
Summary: Integer overflow does not cast as float
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 5.3.2
New Comment:
I can't really see any way this could occur other than your server
having a 64-bit install of Linux on it. What distribution is the
server running, what does "uname -m" output, and what does configure
say the host and target system types are?
(Side note: the manual could admittedly be a bit clearer on this;
although the fact integer size differs on different platforms is
mentioned, it might be useful if the Integer Overflow section
actually reiterated it. I'll see about updating it.)
Previous Comments:
------------------------------------------------------------------------
[2010-03-26 06:21:39] ssufficool at gmail dot com
64 bit ubuntu 10.04 PHP 5.3 SVN:
int(2147483647)
int(2147483648)
32 bit machine and OS PHP 5.2.10:
int(2147483647)
float(2147483648)
------------------------------------------------------------------------
[2010-03-11 19:05:31] cduncan at regatta dot com
64bit machine, 32bit OS.
Also, wouldn't we expect a 64bit to return:
int(2147483647)
int(2147483648)
------------------------------------------------------------------------
[2010-03-11 17:58:30] jani@php.net
Could it possibly be that you're running this on 64bit machine? :)
------------------------------------------------------------------------
[2010-03-11 15:15:38] cduncan at regatta dot com
Description:
------------
The manual (http://php.net/manual/pl/language.types.integer.php)
includes the following segment to cover integer overflow:
<?php
$large_number = 2147483647;
var_dump($large_number);
// output: int(2147483647)
$large_number = 2147483648;
var_dump($large_number);
// output: float(2147483648)
?>
However when I try this on my recently upgraded server they are both
output as int(2147483647)
Test script:
---------------
$large_number = 2147483647;
var_dump($large_number);
$large_number = 2147483648;
var_dump($large_number);
Expected result:
----------------
I expect to see;
int(2147483647)
float(2147483648)
As I do on my box running 5.3.1
Actual result:
--------------
int(2147483647)
int(2147483647)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51274&edit=1