Skip to content

Commit 5c79841

Browse files
committed
Fix segfault in zend_test_execute_internal()
zend_pass_function also has no name, so we might also be referring to an internal function here. In this case, ZEND_NEW uses the zend_pass_function when there is no constructor. Fixes GH-16294 Closes GH-16301
1 parent b5c09b1 commit 5c79841

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ext/zend_test/observer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static void zend_test_execute_internal(zend_execute_data *execute_data, zval *re
288288
} else {
289289
php_printf("%*s<!-- internal enter %s() -->\n", 2 * ZT_G(observer_nesting_depth), "", ZSTR_VAL(fbc->common.function_name));
290290
}
291-
} else {
291+
} else if (ZEND_USER_CODE(fbc->type)) {
292292
php_printf("%*s<!-- internal enter '%s' -->\n", 2 * ZT_G(observer_nesting_depth), "", ZSTR_VAL(fbc->op_array.filename));
293293
}
294294

ext/zend_test/tests/gh16294.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
GH-16294: Segfault in test observer on zend_pass_function
3+
--EXTENSIONS--
4+
zend_test
5+
--INI--
6+
zend_test.observer.execute_internal=1
7+
--FILE--
8+
<?php
9+
10+
class Foo {};
11+
new Foo([]);
12+
13+
?>
14+
===DONE===
15+
--EXPECT--
16+
===DONE===

0 commit comments

Comments
 (0)