@@ -11182,9 +11182,8 @@ static void zend_compile_const_expr_magic_const(zend_ast **ast_ptr) /* {{{ */
1118211182}
1118311183/* }}} */
1118411184
11185- static void zend_compile_const_expr_new (zend_ast * * ast_ptr )
11185+ static void zend_compile_const_expr_class_reference (zend_ast * class_ast )
1118611186{
11187- zend_ast * class_ast = (* ast_ptr )-> child [0 ];
1118811187 if (class_ast -> kind == ZEND_AST_CLASS ) {
1118911188 zend_error_noreturn (E_COMPILE_ERROR ,
1119011189 "Cannot use anonymous class in constant expression" );
@@ -11207,6 +11206,12 @@ static void zend_compile_const_expr_new(zend_ast **ast_ptr)
1120711206 class_ast -> attr = fetch_type << ZEND_CONST_EXPR_NEW_FETCH_TYPE_SHIFT ;
1120811207}
1120911208
11209+ static void zend_compile_const_expr_new (zend_ast * * ast_ptr )
11210+ {
11211+ zend_ast * class_ast = (* ast_ptr )-> child [0 ];
11212+ zend_compile_const_expr_class_reference (class_ast );
11213+ }
11214+
1121011215static void zend_compile_const_expr_closure (zend_ast * * ast_ptr )
1121111216{
1121211217 zend_ast_decl * closure_ast = (zend_ast_decl * ) * ast_ptr ;
@@ -11256,9 +11261,7 @@ static void zend_compile_const_expr_fcc(zend_ast **ast_ptr)
1125611261 }
1125711262 case ZEND_AST_STATIC_CALL : {
1125811263 zend_ast * class_ast = (* ast_ptr )-> child [0 ];
11259- if (class_ast -> kind != ZEND_AST_ZVAL || Z_TYPE_P (zend_ast_get_zval (class_ast )) != IS_STRING ) {
11260- zend_error_noreturn (E_COMPILE_ERROR , "Cannot use dynamic class name in constant expression" );
11261- }
11264+ zend_compile_const_expr_class_reference (class_ast );
1126211265 zend_ast * method_ast = (* ast_ptr )-> child [1 ];
1126311266 if (method_ast -> kind != ZEND_AST_ZVAL || Z_TYPE_P (zend_ast_get_zval (method_ast )) != IS_STRING ) {
1126411267 zend_error_noreturn (E_COMPILE_ERROR , "Cannot use dynamic method name in constant expression" );
0 commit comments