mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
3a5fa926bf
commit afe963e6cc289696e60c6c679796ba2197c52b3b Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Nov 13 15:32:29 2015 +0300 Added news entry commit a126b891c97848dd7ef8f1abf716328c46e0f19c Author: Dmitry Stogov <dmitry@zend.com> Date: Fri Nov 13 15:29:21 2015 +0300 VERIFY_RETURN_TYPE doesn't have to cleanup operand on exception, bacause now, live temporary variables are released by exception unwinder. commit 0db475e98786e6bcaa8401ee3e0b33743b9a2f2b Author: Dmitry Stogov <dmitry@zend.com> Date: Thu Nov 12 22:55:39 2015 +0300 Fixed copy/paste commit 0ac73fe7174bec9de9a610319a98b259bea67f7f Author: Dmitry Stogov <dmitry@zend.com> Date: Wed Nov 11 16:11:50 2015 +0300 Fixed bug #62210 (Exceptions can leak temporary variables)
49 lines
744 B
PHP
49 lines
744 B
PHP
--TEST--
|
|
Temporary leak with foreach
|
|
--FILE--
|
|
<?php
|
|
|
|
function ops() {
|
|
throw new Exception();
|
|
}
|
|
|
|
$a = [new stdClass, new stdClass];
|
|
foreach ([$a, [new stdClass]] as $b) {
|
|
switch ($b[0]) {
|
|
case false:
|
|
break;
|
|
default:
|
|
try {
|
|
$x = 2;
|
|
$y = new stdClass;
|
|
while ($x-- && new stdClass) {
|
|
$r = [$x] + ($y ? ((array) $x) + [2] : ops());
|
|
$y = (array) $y;
|
|
}
|
|
} catch (Exception $e) {
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ([$a, [new stdClass]] as $b) {
|
|
try {
|
|
switch ($b[0]) {
|
|
case false:
|
|
break;
|
|
default:
|
|
$x = 2;
|
|
$y = new stdClass;
|
|
while ($x-- && new stdClass) {
|
|
$r = [$x] + ($y ? ((array) $x) + [2] : ops());
|
|
$y = (array) $y;
|
|
}
|
|
}
|
|
} catch (Exception $e) {
|
|
}
|
|
}
|
|
|
|
?>
|
|
==DONE==
|
|
--EXPECT--
|
|
==DONE==
|