Bug #53934 [NEW]: The negative PHP_INT_MAX is incorrectly converted to float
| From: | eriksen dot costa at infranology dot com dot br | Date: | Sat, 05 Feb 2011 13:53:32 +0000 |
| Subject: | Bug #53934 [NEW]: The negative PHP_INT_MAX is incorrectly converted to float | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-158510@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.3.5
Package: Scripting Engine problem
Bug Type: Bug
Bug description:The negative PHP_INT_MAX is incorrectly converted to float
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 bug report at http://bugs.php.net/bug.php?id=53934&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53934&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53934&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53934&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53934&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53934&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53934&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53934&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53934&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53934&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53934&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53934&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53934&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53934&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53934&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53934&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53934&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53934&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53934&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53934&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53934&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53934&r=mysqlcfg