1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 17:38:14 +02:00

Merge branch 'PHP-5.5'

This commit is contained in:
Nikita Popov
2013-02-01 19:53:23 +01:00
2 changed files with 40 additions and 4 deletions
@@ -0,0 +1,30 @@
--TEST--
Test nested calls with die() in a generator
--FILE--
<?php
function gen() {
die('Test');
yield; // force generator
}
function function_with_3_args() {
$gen = gen();
$gen->rewind();
}
function function_with_4_args() {
function_with_3_args(4, 5, 6);
}
function outerGen() {
function_with_4_args(0, 1, 2, 3);
yield; // force generator
}
$outerGen = outerGen();
$outerGen->rewind();
?>
--EXPECT--
Test
+10 -4
View File
@@ -94,10 +94,16 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
/* Clear any backed up stack arguments */
if (generator->stack != EG(argument_stack)) {
void **stack_frame = zend_vm_stack_frame_base(execute_data);
while (generator->stack->top != stack_frame) {
zval_ptr_dtor((zval**)stack_frame);
stack_frame++;
void **ptr = generator->stack->top - 1;
void **end = zend_vm_stack_frame_base(execute_data);
/* If the top stack element is the argument count, skip it */
if (execute_data->function_state.arguments) {
ptr--;
}
for (; ptr >= end; --ptr) {
zval_ptr_dtor((zval**) ptr);
}
}