diff --git a/Zend/tests/first_class_callable_assert2.phpt b/Zend/tests/first_class_callable_assert2.phpt new file mode 100644 index 00000000000..a55f4184dc8 --- /dev/null +++ b/Zend/tests/first_class_callable_assert2.phpt @@ -0,0 +1,11 @@ +--TEST-- +Foo(...) in attribute in assert +--FILE-- + +--EXPECTF-- +Fatal error: Cannot create Closure as attribute argument in %s on line %d diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 58fbd42ea73..a2bbf2c9c5d 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -1480,9 +1480,7 @@ static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_d static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast *ast, int indent) { zend_ast_list *list = zend_ast_get_list(ast); - uint32_t i, j; - - for (i = 0; i < list->children; i++) { + for (uint32_t i = 0; i < list->children; i++) { zend_ast *attr = list->child[i]; if (i) { @@ -1491,15 +1489,8 @@ static ZEND_COLD void zend_ast_export_attribute_group(smart_str *str, zend_ast * zend_ast_export_ns_name(str, attr->child[0], 0, indent); if (attr->child[1]) { - zend_ast_list *args = zend_ast_get_list(attr->child[1]); - smart_str_appendc(str, '('); - for (j = 0; j < args->children; j++) { - if (j) { - smart_str_appends(str, ", "); - } - zend_ast_export_ex(str, args->child[j], 0, indent); - } + zend_ast_export_ex(str, attr->child[1], 0, indent); smart_str_appendc(str, ')'); } }