serialization_objects_010.phpt 784 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Serialize() must return a string or NULL
  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. Class C implements Serializable {
  16. public function serialize() {
  17. return $this;
  18. }
  19. public function unserialize($blah) {
  20. }
  21. }
  22. try {
  23. var_dump(serialize(new C));
  24. } catch (Exception $e) {
  25. echo $e->getMessage(). "\n";
  26. }
  27. echo "Done";
  28. ?>
  29. --EXPECT--
  30. C::serialize() must return a string or NULL
  31. Done