Edit report at https://bugs.php.net/bug.php?id=53934&edit=1

 ID:                 53934
 Comment by:         ajf at ajf dot me
 Reported by:        eriksen dot costa at infranology dot com dot br
 Summary:            The negative PHP_INT_MAX is incorrectly converted to
                     float
 Status:             Verified
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

@catphract:

In that case is it not a tokeniser issue, and "-9223372036854775807" should be 
tokenised to '-9223372036854775807' not '-' '9223372036854775807'?


Previous Comments:
------------------------------------------------------------------------
[2011-02-05 18:55:33] cataphr...@php.net

The problem is that "-9223372036854775808" is not parsed as an integer, instead 
the minus sign and the rest are parsed individually and 9223372036854775808 is 
bigger than LONG_MAX.

Probably this is not trivial to fix.

------------------------------------------------------------------------
[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.co...@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 https://bugs.php.net/bug.php?id=53934&edit=1

Reply via email to