|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-09-08 02:45 UTC] crescent at corruptinteractive dot com
[2003-09-08 06:05 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 06:00:02 2025 UTC |
Description: ------------ This bug only appeared after upgrading from php 4.3.1 to php 4.3.3 When serializing an array of floating point values with a specific decimal value of significance (ie: thousandths), once the array is serialized, bogus values are stored after the hundredth decimal position. Here is a short, simple example: Reproduce code: --------------- $array[0] = 0; $array[1] = 1.111; $array[2] = 2.222; $array[3] = 3.333; $array[4] = 4.444; $array[5] = 5.555; $array = serialize($array); echo "Array = $array"; Expected result: ---------------- Array = a:6:{i:0;i:0;i:1;d:1.111;i:2;d:2.222;i:3;d:3.333;i:4;d:4.444;i:5;d:5.555;} Actual result: -------------- Array = a:6:{i:0;i:0;i:1;d:1.1109999999999999875655021241982467472553253173828125;i:2;d:2.221999999999999975131004248396493494510650634765625;i:3;d:3.3330000000000001847411112976260483264923095703125;i:4;d:4.44399999999999995026200849679298698902130126953125;i:5;d:5.55499999999999971578290569595992565155029296875;} Notice the bogus values after the hundredth decimal place for each array element.