Bug #53934 [Opn->Ver]: The negative PHP_INT_MAX is incorrectly converted to float
| From: | cataphract@php.net | Date: | Sat, 05 Feb 2011 16:34:55 +0000 |
| Subject: | Bug #53934 [Opn->Ver]: The negative PHP_INT_MAX is incorrectly converted to float | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158511@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53934&edit=1
ID: 53934
Updated by: cataphract@php.net
Reported by: eriksen dot costa at infranology dot com dot br
Summary: The negative PHP_INT_MAX is incorrectly converted to
float
-Status: Open
+Status: Verified
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.5
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2011-02-05 14:53:32] eriksen dot costa at infranology dot com dot br
Description:
------------
I found this and seems a bug. Everytime I use the negative PHP_INT_MAX
literally (-9223372036854775808) as a function parameter, it is
converted to float.
However, if I pass it like an expression -9223372036854775807 - 1, it is
correctly identified as an integer.
Test script:
---------------
--TEST--
Checks if the negative PHP_INT_MAX is treated as integer.
--CREDITS--
Eriksen Costa <eriksen.costa@infranology.com.br>
--SKIPIF--
<?php
if (PHP_INT_SIZE < 8) die('64bit platforms only');
?>
--FILE--
<?php
var_dump(-9223372036854775807 - 1);
var_dump((PHP_INT_MAX * -1) - 1);
var_dump(-9223372036854775808);
?>
--EXPECT--
int(-9223372036854775808);
int(-9223372036854775808);
int(-9223372036854775808);
Expected result:
----------------
int(-9223372036854775808);
int(-9223372036854775808);
int(-9223372036854775808);
Actual result:
--------------
int(-9223372036854775808)
int(-9223372036854775808)
float(-9.2233720368548E+18)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53934&edit=1