php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26247 Problem with serialize function
Submitted: 2003-11-14 04:14 UTC Modified: 2003-11-14 10:38 UTC
From: sgarrouste at agencecap dot net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.3 OS: Linux Suze
Private report: No CVE-ID: None
 [2003-11-14 04:14 UTC] sgarrouste at agencecap dot net
Description:
------------
Hello

I have un bug with the function serialize.
I need to serialize object for testing if they not changed.
The bug appear when i serialize type is double but disappear when i unzerialize.
i explain this in the reproduce code.
i think it's a problem of approximation.

thank for the answer.

ps: my english is not very good, excuse me

Reproduce code:
---------------
<?php

$test = 13.1;
echo "test = ".$test."<br>";
$test2 = serialize($test);
echo "test2(serialize) = ".$test2."<br>";
echo "test2(unserialize) = ".unserialize($test2);

?>

Expected result:
----------------
test = 13.1
test2(serialize) = d:13.1;
test2(unserialize) = 13.1

Actual result:
--------------
test = 13.1
test2(serialize) = d:13.0999999999999996447286321199499070644378662109375;
test2(unserialize) = 13.1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-14 10:37 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2003-11-14 10:38 UTC] iliaa@php.net
This is expected behaviour
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 05:01:27 2024 UTC