Edit report at https://bugs.php.net/bug.php?id=64349&edit=1
ID: 64349 Updated by: ras...@php.net Reported by: pprem at pprem dot net Summary: serialize don't work with class/object -Status: Open +Status: Feedback Type: Bug Package: Class/Object related Operating System: Ubuntu 12.10 PHP Version: 5.4.12 Block user comment: N Private report: N New Comment: Your test script works fine here for me with PHP 5.4.13-dev Do you have any special extensions loaded that might be affecting this? Try it from the command line with php -n Previous Comments: ------------------------------------------------------------------------ [2013-03-04 14:54:48] pprem at pprem dot net Description: ------------ serialize don't work on stdClass anymore: nothing is get as return of serialize($test) when $test is an object Test script: --------------- <?php function test_($var) { $start = serialize ($var); $nb_ok = $nb_nok = 0; for ($i = 0; $i < 100; $i ++) { $end = serialize(unserialize($start)); if ($star == $end) { $nb_ok++; } else { $nb_nok++; } } print("<p>".htmlentities($start)."<br />ok=".$nb_ok."<br />nok=".$nb_nok."</p>"); } test_(5); test_("254retet"); test_(array(54,7,687,"ihju",24,"","52s7")); $test = new stdClass(); $test->bidule="57geré"; $test->truc=547; $test->machin=54.47; $test->chose="dsf24sdg"; test_($test); $test2 = new stdClass(); $test2->first="dflgid"; $test2->second=$test; $test2->third=2; test_($test2); ?> Expected result: ---------------- i:5; ok=0 nok=100 s:8:"254retet"; ok=0 nok=100 a:7: {i:0;i:54;i:1;i:7;i:2;i:687;i:3;s:4:"ihju";i:4;i:24;i:5;s:0:"";i:6;s:4:"52s7";} ok=0 nok=100 O:8:"stdClass":4: {s:6:"bidule";s:6:"57geré";s:4:"truc";i:547;s:6:"machin";d:54.469999999999999;s: 5:"chose";s:8:"dsf24sdg";} ok=0 nok=100 O:8:"stdClass":3:{s:5:"first";s:6:"dflgid";s:6:"second";O:8:"stdClass":4: {s:6:"bidule";s:6:"57geré";s:4:"truc";i:547;s:6:"machin";d:54.469999999999999;s: 5:"chose";s:8:"dsf24sdg";}s:5:"third";i:2;} ok=0 nok=100 Actual result: -------------- i:5; ok=0 nok=100 s:8:"254retet"; ok=0 nok=100 a:7: {i:0;i:54;i:1;i:7;i:2;i:687;i:3;s:4:"ihju";i:4;i:24;i:5;s:0:"";i:6;s:4:"52s7";} ok=0 nok=100 ok=0 nok=100 ok=0 nok=100 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64349&edit=1