From: [EMAIL PROTECTED] Operating system: Gentoo Linux PHP version: 5.2.1RC3 PHP Bug Type: Variables related Bug description: serialize breaks with floats if locale is set to de_DE
Description: ------------ If locale is set to de_DE serialized arrays and objects with floats somewhere cannot be unserialized. Reproduce code: --------------- <?php error_reporting(E_ALL); ini_set('display_errors', 1); echo 'Setting locale to ' . setlocale(LC_ALL, 'de_DE') . "\n"; // Remove this to make it work $array = array('myval' => 1.2345); echo 'Serializing '; var_export($array); echo "\n"; $serialized = serialize($array); echo 'Got: ' . $serialized . "\n"; echo "Unserializing.\n"; $unserialized = unserialize($serialized); echo 'Got: ' . var_export($unserialized, true) . "\n"; echo 'This should be true: ' . var_export(($unserialized === $array), true) . "\n"; ?> Expected result: ---------------- $ php locale_serialize.php Serializing array ( 'myval' => 1.2345, ) Got: a:1:{s:5:"myval";d:1.2344999999999999307220832633902318775653839111328125;} Unserializing. Got: array ( 'myval' => 1.2345, ) This should be true: true Actual result: -------------- $ php locale_serialize.php Setting locale to de_DE Serializing array ( 'myval' => 1,2345, ) Got: a:1:{s:5:"myval";d:1,2344999999999999307220832633902318775653839111328125;} Unserializing. Notice: unserialize(): Error at offset 17 of 75 bytes in /var/www/alan-live/htdoc/test/locale_serialize.php on line 16 Got: false This should be true: false -- Edit bug report at http://bugs.php.net/?id=40235&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40235&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40235&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40235&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40235&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40235&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40235&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40235&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40235&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40235&r=support Expected behavior: http://bugs.php.net/fix.php?id=40235&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40235&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40235&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40235&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40235&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40235&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40235&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40235&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40235&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40235&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40235&r=mysqlcfg