1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix backtraces with overridden zend_execute_ex
This commit is contained in:
Nikita Popov
2021-09-29 16:25:20 +02:00
2 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
--TEST--
bug_debug_backtrace.phpt with replaced zend_execute_ex
--EXTENSIONS--
zend_test
--INI--
zend_test.replace_zend_execute_ex=1
--FILE--
<?php
function foo() {
bar();
}
function bar() {
boo();
}
function boo(){
debug_print_backtrace();
}
eval("foo();");
echo "Done\n";
?>
--EXPECTF--
#0 %s(%d): boo()
#1 %s(%d): bar()
#2 %s(%d) : eval()'d code(1): foo()
#3 %s(%d): eval()
Done

View File

@@ -1820,7 +1820,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
skip_frame:
if (UNEXPECTED((ZEND_CALL_INFO(call) & ZEND_CALL_TOP_FUNCTION) != 0)
if (UNEXPECTED(ZEND_CALL_KIND(call) == ZEND_CALL_TOP_FUNCTION)
&& !fake_frame
&& prev
&& prev->func