From: pprem at pprem dot net Operating system: Ubuntu 12.10 PHP version: 5.4.12 Package: Class/Object related Bug Type: Bug Bug description:serialize don't work with class/object
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 bug report at https://bugs.php.net/bug.php?id=64349&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64349&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64349&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64349&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64349&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64349&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64349&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64349&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64349&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64349&r=support Expected behavior: https://bugs.php.net/fix.php?id=64349&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64349&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64349&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64349&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64349&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64349&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64349&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64349&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64349&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64349&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64349&r=mysqlcfg