Browse Source
Merge branch 'PHP-8.5'
* PHP-8.5:
Fix missing new Foo(...) error in constant expressions
pull/19661/merge
Ilija Tovilo
3 weeks ago
No known key found for this signature in database
GPG Key ID: 115CEA7A713E12E9
2 changed files with
13 additions and
0 deletions
-
Zend/tests/gh20113.phpt
-
Zend/zend_compile.c
|
|
|
@ -0,0 +1,8 @@ |
|
|
|
--TEST-- |
|
|
|
GH-20113: new Foo(...) error in constant expressions |
|
|
|
--FILE-- |
|
|
|
<?php |
|
|
|
const C = new \stdClass(...); |
|
|
|
?> |
|
|
|
--EXPECTF-- |
|
|
|
Fatal error: Cannot create Closure for new expression in %s on line %d |
|
|
|
@ -11488,6 +11488,11 @@ static void zend_compile_const_expr_new(zend_ast **ast_ptr) |
|
|
|
{ |
|
|
|
zend_ast *class_ast = (*ast_ptr)->child[0]; |
|
|
|
zend_compile_const_expr_class_reference(class_ast); |
|
|
|
|
|
|
|
zend_ast *args_ast = (*ast_ptr)->child[1]; |
|
|
|
if (args_ast->kind == ZEND_AST_CALLABLE_CONVERT) { |
|
|
|
zend_error_noreturn(E_COMPILE_ERROR, "Cannot create Closure for new expression"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void zend_compile_const_expr_closure(zend_ast **ast_ptr) |
|
|
|
|