Skip to content

Commit 018ddba

Browse files
committed
Fix backtraces with overridden zend_execute_ex
1 parent 96ac919 commit 018ddba

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
bug_debug_backtrace.phpt with replaced zend_execute_ex
3+
--EXTENSIONS--
4+
zend_test
5+
--INI--
6+
zend_test.replace_zend_execute_ex=1
7+
--FILE--
8+
<?php
9+
function foo() {
10+
bar();
11+
}
12+
13+
function bar() {
14+
boo();
15+
}
16+
17+
function boo(){
18+
debug_print_backtrace();
19+
}
20+
21+
eval("foo();");
22+
23+
echo "Done\n";
24+
?>
25+
--EXPECTF--
26+
#0 %s(%d): boo()
27+
#1 %s(%d): bar()
28+
#2 %s(%d) : eval()'d code(1): foo()
29+
#3 %s(%d): eval()
30+
Done

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int
18201820
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
18211821

18221822
skip_frame:
1823-
if (UNEXPECTED((ZEND_CALL_INFO(call) & ZEND_CALL_TOP_FUNCTION) != 0)
1823+
if (UNEXPECTED(ZEND_CALL_KIND(call) == ZEND_CALL_TOP_FUNCTION)
18241824
&& !fake_frame
18251825
&& prev
18261826
&& prev->func

0 commit comments

Comments
 (0)