serialization_objects_007.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Ensure __autoload is called twice if unserialize_callback_func is defined.
  3. --FILE--
  4. <?php
  5. /* Prototype : proto string serialize(mixed variable)
  6. * Description: Returns a string representation of variable (which can later be unserialized)
  7. * Source code: ext/standard/var.c
  8. * Alias to functions:
  9. */
  10. /* Prototype : proto mixed unserialize(string variable_representation)
  11. * Description: Takes a string representation of variable and recreates it
  12. * Source code: ext/standard/var.c
  13. * Alias to functions:
  14. */
  15. function __autoload($name) {
  16. echo "in __autoload($name)\n";
  17. }
  18. ini_set('unserialize_callback_func','check');
  19. function check($name) {
  20. echo "in check($name)\n";
  21. }
  22. $o = unserialize('O:3:"FOO":0:{}');
  23. var_dump($o);
  24. echo "Done";
  25. ?>
  26. --EXPECTF--
  27. in __autoload(FOO)
  28. in check(FOO)
  29. in __autoload(FOO)
  30. Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23
  31. object(__PHP_Incomplete_Class)#%d (1) {
  32. ["__PHP_Incomplete_Class_Name"]=>
  33. string(3) "FOO"
  34. }
  35. Done