tostring_003.phpt 400 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. ZE2 __toString() in __destruct/exception
  3. --FILE--
  4. <?php
  5. class Test
  6. {
  7. function __toString()
  8. {
  9. throw new Exception("Damn!");
  10. return "Hello\n";
  11. }
  12. function __destruct()
  13. {
  14. echo $this;
  15. }
  16. }
  17. try
  18. {
  19. $o = new Test;
  20. $o = NULL;
  21. }
  22. catch(Exception $e)
  23. {
  24. var_dump($e->getMessage());
  25. }
  26. ?>
  27. ====DONE====
  28. --EXPECT--
  29. string(5) "Damn!"
  30. ====DONE====