File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-20113: new Foo(...) error in constant expressions
3+ --FILE--
4+ <?php 
5+ const  C  = new  \stdClass (...);
6+ ?> 
7+ --EXPECTF--
8+ Fatal error: Cannot create Closure for new expression in %s on line %d
Original file line number Diff line number Diff line change @@ -11488,6 +11488,11 @@ static void zend_compile_const_expr_new(zend_ast **ast_ptr)
1148811488{
1148911489	zend_ast  * class_ast  =  (* ast_ptr )-> child [0 ];
1149011490	zend_compile_const_expr_class_reference (class_ast );
11491+ 
11492+ 	zend_ast  * args_ast  =  (* ast_ptr )-> child [1 ];
11493+ 	if  (args_ast -> kind  ==  ZEND_AST_CALLABLE_CONVERT ) {
11494+ 		zend_error_noreturn (E_COMPILE_ERROR , "Cannot create Closure for new expression" );
11495+ 	}
1149111496}
1149211497
1149311498static  void  zend_compile_const_expr_closure (zend_ast  * * ast_ptr )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments