bug69210.phpt 689 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. serialize() integrity with non string on __sleep
  3. --FILE--
  4. <?php
  5. class testString
  6. {
  7. public $a = true;
  8. public function __sleep()
  9. {
  10. return array('a', '1');
  11. }
  12. }
  13. class testInteger
  14. {
  15. public $a = true;
  16. public function __sleep()
  17. {
  18. return array('a', 1);
  19. }
  20. }
  21. $cs = new testString();
  22. $ci = new testInteger();
  23. $ss = @serialize($cs);
  24. echo $ss . "\n";
  25. $si = @serialize($ci);
  26. echo $si . "\n";
  27. var_dump(unserialize($ss));
  28. var_dump(unserialize($si));
  29. ?>
  30. --EXPECT--
  31. O:10:"testString":1:{s:1:"a";b:1;}
  32. O:11:"testInteger":1:{s:1:"a";b:1;}
  33. object(testString)#3 (1) {
  34. ["a"]=>
  35. bool(true)
  36. }
  37. object(testInteger)#3 (1) {
  38. ["a"]=>
  39. bool(true)
  40. }