From a439d9f232593e8a2ac21e2cd21d8c2e67b00291 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 13 Apr 2021 15:25:05 +0300 Subject: [PATCH] Call zend_generator_check_placeholder_frame() only for frames with ZEND_CALL_GENERATOR flag --- Zend/zend_builtin_functions.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 98780eda2dd..268fcfaadc6 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1709,7 +1709,9 @@ ZEND_FUNCTION(debug_print_backtrace) call_type = NULL; ZVAL_UNDEF(&arg_array); - ptr = zend_generator_check_placeholder_frame(ptr); + if (UNEXPECTED((ZEND_CALL_INFO(call) & ZEND_CALL_GENERATOR) != 0)) { + ptr = zend_generator_check_placeholder_frame(ptr); + } skip = ptr; /* skip internal handler */ @@ -1911,7 +1913,9 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int stack_frame = zend_new_array(8); zend_hash_real_init_mixed(stack_frame); - ptr = zend_generator_check_placeholder_frame(ptr); + if (UNEXPECTED((ZEND_CALL_INFO(call) & ZEND_CALL_GENERATOR) != 0)) { + ptr = zend_generator_check_placeholder_frame(ptr); + } skip = ptr; /* skip internal handler */