SplObjectStorage_unserialize_nested.phpt 772 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. SPL: Test unserializing tested & linked storage
  3. --FILE--
  4. <?php
  5. $o = new StdClass();
  6. $a = new StdClass();
  7. $o->a = $a;
  8. $so = new SplObjectStorage();
  9. $so[$o] = 1;
  10. $so[$a] = 2;
  11. $s = serialize($so);
  12. echo $s."\n";
  13. $so1 = unserialize($s);
  14. var_dump($so1);
  15. --EXPECTF--
  16. C:16:"SplObjectStorage":76:{x:i:2;O:8:"stdClass":1:{s:1:"a";O:8:"stdClass":0:{}},i:1;;r:4;,i:2;;m:a:0:{}}
  17. object(SplObjectStorage)#4 (1) {
  18. ["storage":"SplObjectStorage":private]=>
  19. array(2) {
  20. ["%s"]=>
  21. array(2) {
  22. ["obj"]=>
  23. object(stdClass)#5 (1) {
  24. ["a"]=>
  25. object(stdClass)#6 (0) {
  26. }
  27. }
  28. ["inf"]=>
  29. int(1)
  30. }
  31. ["%s"]=>
  32. array(2) {
  33. ["obj"]=>
  34. object(stdClass)#6 (0) {
  35. }
  36. ["inf"]=>
  37. int(2)
  38. }
  39. }
  40. }