Skip to content

Commit 13f6ffe

Browse files
committed
Fix zend_ast_apply to zend_ast_decl
1 parent bd7f612 commit 13f6ffe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Zend/zend_ast.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,13 @@ ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn, void *contex
12431243
for (i = 0; i < list->children; ++i) {
12441244
fn(&list->child[i], context);
12451245
}
1246+
} else if (zend_ast_is_decl(ast)) {
1247+
/* Nothing to do. */
1248+
zend_ast_decl *decl = (zend_ast_decl*)ast;
1249+
uint32_t i;
1250+
for (i = 0; i < 5; ++i) {
1251+
fn(&decl->child[i], context);
1252+
}
12461253
} else {
12471254
uint32_t i, children = zend_ast_get_num_children(ast);
12481255
for (i = 0; i < children; ++i) {

Zend/zend_compile.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11293,7 +11293,8 @@ static void zend_compile_const_expr(zend_ast **ast_ptr, void *context) /* {{{ */
1129311293
break;
1129411294
case ZEND_AST_CLOSURE:
1129511295
zend_compile_const_expr_closure(ast_ptr);
11296-
break;
11296+
/* Return, because we do not want to traverse the children. */
11297+
return;
1129711298
}
1129811299

1129911300
zend_ast_apply(ast, zend_compile_const_expr, context);

0 commit comments

Comments
 (0)