#32442 [Opn->Csd]: serialize/unserialize floats with de-locales

From: Date: Thu, 24 Mar 2005 17:09:38 +0000
Subject: #32442 [Opn->Csd]: serialize/unserialize floats with de-locales
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-76921@lists.php.net to get a copy of this message
ID: 32442 Updated by: sniper@php.net Reported By: niels at monarch dot de -Status: Open +Status: Closed Bug Type: Variables related Operating System: Linux PHP Version: 4.3.10 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-03-24 16:49:58] niels at monarch dot de Description: ------------ When unserializing a previously serialized float that contains a exponent-expressed value (ie. 5Mrd), the result is wrong when locale is set to setlocale(LC_ALL,"de_DE"); (with compiled de-locales, of course) With the locales set to "C", everything works fine. In my opinion, this is a ',','.'-number-format-handling error. Reproduce code: --------------- setlocale (LC_ALL,"de_DE"); echo "test:".(float)3.14152; $fl1=(float)5000000000; // 5Mrd $str=serialize ($fl1); $fl2=unserialize($str); var_dump ($fl1); var_dump ($fl2); phpinfo(); Expected result: ---------------- test:3,14152 float(5.0E+9) float(5.0E+9) Actual result: -------------- test:3,14152 (OK) float(5.0E+9) float(5) (hrmm, not quite!) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32442&edit=1

« previous php.bugs (#76921) next »