diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 7932bf597471f..40aae750a5fd8 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1553,8 +1553,8 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio break; case ZEND_AST_CLASS: decl = (zend_ast_decl *) ast; - if (decl->child[4]) { - zend_ast_export_attributes(str, decl->child[4], indent, 1); + if (decl->child[3]) { + zend_ast_export_attributes(str, decl->child[3], indent, 1); } if (decl->flags & ZEND_ACC_INTERFACE) { smart_str_appends(str, "interface "); @@ -1889,8 +1889,8 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio smart_str_appends(str, "new "); if (ast->child[0]->kind == ZEND_AST_CLASS) { zend_ast_decl *decl = (zend_ast_decl *) ast->child[0]; - if (decl->child[4]) { - zend_ast_export_attributes(str, decl->child[4], indent, 0); + if (decl->child[3]) { + zend_ast_export_attributes(str, decl->child[3], indent, 0); } smart_str_appends(str, "class"); if (zend_ast_get_list(ast->child[1])->children) { @@ -2260,10 +2260,12 @@ zend_ast * ZEND_FASTCALL zend_ast_with_attributes(zend_ast *ast, zend_ast *attr) case ZEND_AST_FUNC_DECL: case ZEND_AST_CLOSURE: case ZEND_AST_METHOD: - case ZEND_AST_CLASS: case ZEND_AST_ARROW_FUNC: ((zend_ast_decl *) ast)->child[4] = attr; break; + case ZEND_AST_CLASS: + ((zend_ast_decl *) ast)->child[3] = attr; + break; case ZEND_AST_PROP_GROUP: ast->child[2] = attr; break; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 36715c7bb5879..ddab4a31fb182 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4501,7 +4501,7 @@ void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */ if (class_ast->kind == ZEND_AST_CLASS) { /* anon class declaration */ - zend_compile_class_decl(&class_node, class_ast, 0); + zend_compile_class_decl(&class_node, class_ast, 0); } else { zend_compile_class_ref(&class_node, class_ast, ZEND_FETCH_CLASS_EXCEPTION); } @@ -7370,8 +7370,8 @@ void zend_compile_class_decl(znode *result, zend_ast *ast, zend_bool toplevel) / CG(active_class_entry) = ce; - if (decl->child[4]) { - zend_compile_attributes(&ce->attributes, decl->child[4], 0, ZEND_ATTRIBUTE_TARGET_CLASS); + if (decl->child[3]) { + zend_compile_attributes(&ce->attributes, decl->child[3], 0, ZEND_ATTRIBUTE_TARGET_CLASS); } if (implements_ast) {