From: cf0hay at gmail dot com Operating system: Linux 64bit (PHP 64bit too) PHP version: 5.4.14 Package: Variables related Bug Type: Bug Bug description:var_export() does not use full precision for floating-point numbers
Description: ------------ var_export() truncates floating-point precision. serialize() does not have the same problem. Test script: --------------- <?php $a = microtime(true); echo "error of serialize(): "; var_export($a - unserialize(serialize($a))); //This returns 0. echo "\n"; echo "error of var_export(): "; eval('$b = '.var_export($a,true).';'); var_export($a - $b); //Almost never 0. echo "\n"; Expected result: ---------------- Exporting a floating-point value should generate enough digits to prevent precision loss. The script above should always return 0 on the second case. Actual result: -------------- The difference between the original floating point value and the one exported differs. The error is about 15 magnitude lower than the magnitude of the value itself. -- Edit bug report at https://bugs.php.net/bug.php?id=64760&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64760&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64760&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64760&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64760&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64760&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64760&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64760&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64760&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64760&r=support Expected behavior: https://bugs.php.net/fix.php?id=64760&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64760&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64760&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64760&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64760&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64760&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64760&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64760&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64760&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64760&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64760&r=mysqlcfg