temporary_cleaning_005.phpt 999 B

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