Skip to content

Commit 5e5ac83

Browse files
committed
Fix cli test
Set the ZEND_CALL_GENERATOR flag on the fake frame also, and set the func field for the empty top frame in cli, to be safe.
1 parent 75620c6 commit 5e5ac83

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
17251725
}
17261726

17271727
while (call && (limit == 0 || frameno < limit)) {
1728-
if (UNEXPECTED(!call->func)) {
1728+
if (UNEXPECTED((ZEND_CALL_INFO(call) & ZEND_CALL_GENERATOR) && !call->func)) {
17291729
/* This is the fake frame inserted for nested generators. Normally,
17301730
* this frame is preceded by the actual generator frame and then
17311731
* replaced by zend_generator_check_placeholder_frame() below.

Zend/zend_vm_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4473,6 +4473,7 @@ ZEND_VM_HANDLER(139, ZEND_GENERATOR_CREATE, ANY, ANY)
44734473
generator->execute_fake.func = NULL;
44744474
generator->execute_fake.prev_execute_data = NULL;
44754475
ZVAL_OBJ(&generator->execute_fake.This, (zend_object *) generator);
4476+
ZEND_ADD_CALL_FLAG(&generator->execute_fake, ZEND_CALL_GENERATOR);
44764477

44774478
gen_execute_data->opline = opline + 1;
44784479
/* EX(return_value) keeps pointer to zend_object (not a real zval) */

Zend/zend_vm_execute.h

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sapi/cli/php_cli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
10751075
object_init_ex(&ref, pce);
10761076

10771077
memset(&execute_data, 0, sizeof(zend_execute_data));
1078+
execute_data.func = (zend_function *) &zend_pass_function;
10781079
EG(current_execute_data) = &execute_data;
10791080
zend_call_known_instance_method_with_1_params(
10801081
pce->constructor, Z_OBJ(ref), NULL, &arg);

0 commit comments

Comments
 (0)