mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Fix AST print of first class callable in anon class expr
This will cause a compile error later, but the expression is printed first. Fixes oss-fuzz #37473.
This commit is contained in:
parent
07984435ae
commit
b964d007e3
10
Zend/tests/first_class_callable_assert3.phpt
Normal file
10
Zend/tests/first_class_callable_assert3.phpt
Normal file
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
new class(...) in assert
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
assert(new class(...) {});
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot create Closure for new expression in %s on line %d
|
@ -2036,7 +2036,8 @@ simple_list:
|
||||
zend_ast_export_attributes(str, decl->child[3], indent, 0);
|
||||
}
|
||||
smart_str_appends(str, "class");
|
||||
if (zend_ast_get_list(ast->child[1])->children) {
|
||||
if (!zend_ast_is_list(ast->child[1])
|
||||
|| zend_ast_get_list(ast->child[1])->children) {
|
||||
smart_str_appendc(str, '(');
|
||||
zend_ast_export_ex(str, ast->child[1], 0, indent);
|
||||
smart_str_appendc(str, ')');
|
||||
|
Loading…
Reference in New Issue
Block a user