temporary_cleaning_004.phpt 804 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Temporary leak with switch
  3. --FILE--
  4. <?php
  5. function ops() {
  6. throw new Exception();
  7. }
  8. $a = [new stdClass, new stdClass];
  9. switch ($a[0]) {
  10. case false:
  11. break;
  12. default:
  13. try {
  14. $x = 2;
  15. $y = new stdClass;
  16. while ($x-- && new stdClass) {
  17. $r = [$x] + ($y ? ((array) $x) + [2] : ops());
  18. $y = (array) $y;
  19. }
  20. } catch (Exception $e) {
  21. }
  22. }
  23. try {
  24. switch ($a[0]) {
  25. case false:
  26. break;
  27. default:
  28. $x = 2;
  29. $y = new stdClass;
  30. while ($x-- && new stdClass) {
  31. $r = [$x] + ($y ? ((array) $x) + [2] : ops());
  32. $y = (array) $y;
  33. }
  34. }
  35. } catch (Exception $e) {
  36. }
  37. ?>
  38. ==DONE==
  39. --EXPECT--
  40. ==DONE==