|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-08-07 18:05 UTC] nikic@php.net
-Status: Open
+Status: Verified
[2018-08-07 18:05 UTC] nikic@php.net
[2019-03-11 14:37 UTC] nikic@php.net
[2019-03-11 14:37 UTC] nikic@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
Description: ------------ var_export() is documented as "Outputs or returns a parsable string representation of a variable" It generates an unparseable value for PHP_INT_MIN: it renders it as a negative decimal. `-x` is not a negative literal; it's a unary op on x. var_export generates '-9223372036854775808' - but as '9223372036854775808' is greater PHP_INT_MAX, this generates a float. Test script: --------------- <?php var_export(PHP_INT_MIN); echo "\n"; var_export(PHP_INT_MAX); echo "\n"; $min = eval('return '.var_export(PHP_INT_MIN, true).';'); $max = eval('return '.var_export(PHP_INT_MAX, true).';'); var_dump($min === PHP_INT_MIN); var_dump($max === PHP_INT_MAX); var_dump($min); var_dump($max); Expected result: ---------------- The last 4 lines of output should be true, true, (an int: value of PHP_INT_MIN), (an int: value of PHP_INT_MAX) Actual result: -------------- -9223372036854775808 9223372036854775807 bool(false) bool(true) float(-9.2233720368548E+18) int(9223372036854775807)