leaks.phpt 505 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. throw expression should not leak temporaries
  3. --FILE--
  4. <?php
  5. try {
  6. new stdClass(throw new Exception);
  7. } catch (Exception $e) {
  8. echo "Caught\n";
  9. }
  10. try {
  11. $a = [];
  12. ($a + [1]) + throw new Exception;
  13. } catch (Exception $e) {
  14. echo "Caught\n";
  15. }
  16. try {
  17. @throw new Exception;
  18. } catch (Exception $e) {
  19. echo "Caught\n";
  20. }
  21. var_dump(error_reporting());
  22. // Exit also unwinds and thus has the same basic problem.
  23. new stdClass(exit);
  24. ?>
  25. --EXPECT--
  26. Caught
  27. Caught
  28. Caught
  29. int(32767)