Bug #78081 [NEW]: I tried to output -9223372036854775808 but it will show -9.2233720368548E+18
| From: | memory dot agape at gmail dot com | Date: | Wed, 29 May 2019 05:59:31 +0000 |
| Subject: | Bug #78081 [NEW]: I tried to output -9223372036854775808 but it will show -9.2233720368548E+18 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-221036@lists.php.net to get a copy of this message | ||
From: memory dot agape at gmail dot com
Operating system: MacOS
PHP version: 7.2.18
Package: *General Issues
Bug Type: Bug
Bug description:I tried to output -9223372036854775808 but it will show -9.2233720368548E+18
Description:
------------
I tried to output a negative value -9223372036854775808 but it will show
a double type value.
It expected an integer value.
My PHP version is shown below:
> php -v
> PHP 7.2.18 (cli) (built: May 21 2019 20:18:44) ( NTS )
> Copyright (c) 1997-2018 The PHP Group
> Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
> with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
> with Zend OPcache v7.2.18, Copyright (c) 1999-2018, by Zend
Technologies
Test script:
---------------
<?php
var_dump(PHP_INT_MIN);
var_dump(-9223372036854775808);
var_dump((int) -9223372036854775808);
var_dump(-9223372036854775807);
var_dump(PHP_INT_MAX);
var_dump(9223372036854775807);
?>
Expected result:
----------------
int(-9223372036854775808)
int(-9223372036854775808)
int(-9223372036854775808)
int(-9223372036854775807)
int(9223372036854775807)
int(9223372036854775807)
Actual result:
--------------
int(-9223372036854775808)
double(-9.2233720368548E+18)
int(-9223372036854775808)
int(-9223372036854775807)
int(9223372036854775807)
int(9223372036854775807)
--
Edit bug report at https://bugs.php.net/bug.php?id=78081&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78081&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78081&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78081&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78081&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78081&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78081&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78081&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78081&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78081&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78081&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78081&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78081&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78081&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78081&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78081&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78081&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78081&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78081&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78081&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78081&r=mysqlcfg