Browse Source

Merge branch 'PHP-7.1'

pull/1376/merge
Bob Weinand 9 years ago
parent
commit
ccb5591728
  1. 29
      Zend/tests/generators/bug74606.phpt
  2. 2
      Zend/zend_generators.c

29
Zend/tests/generators/bug74606.phpt

@ -0,0 +1,29 @@
--TEST--
Bug #74606 (Segfault within try/catch/finally nesting in Generators)
--FILE--
<?php
function gen() {
$array = ["foo"];
$array[] = "bar";
foreach ($array as $item) {
try {
try {
yield;
} finally {
echo "fin $item\n";
}
} catch (\Exception $e) {
echo "catch\n";
continue;
}
}
}
gen()->throw(new Exception);
?>
--EXPECT--
fin foo
catch
fin bar

2
Zend/zend_generators.c

@ -108,7 +108,7 @@ static void zend_generator_cleanup_unfinished_execution(
if (UNEXPECTED(generator->frozen_call_stack)) {
zend_generator_restore_call_stack(generator);
}
zend_cleanup_unfinished_execution(execute_data, op_num, 0);
zend_cleanup_unfinished_execution(execute_data, op_num, catch_op_num);
}
}
/* }}} */

Loading…
Cancel
Save