@@ -4563,32 +4563,36 @@ static zend_result zend_compile_frameless_icall(znode *result, zend_ast_list *ar
4563
4563
}
4564
4564
4565
4565
while (frameless_function_info -> handler ) {
4566
- if (frameless_function_info -> num_args == args -> children ) {
4567
- uint32_t offset = find_frameless_function_offset (args -> children , frameless_function_info -> handler );
4566
+ if (frameless_function_info -> num_args >= args -> children
4567
+ && fbc -> common .required_num_args <= args -> children ) {
4568
+ uint32_t num_args = frameless_function_info -> num_args ;
4569
+ uint32_t offset = find_frameless_function_offset (num_args , frameless_function_info -> handler );
4568
4570
if (offset == (uint32_t )-1 ) {
4569
4571
continue ;
4570
4572
}
4571
- znode arg1 , arg2 , arg3 ;
4572
- if (args -> children >= 1 ) {
4573
- zend_compile_expr (& arg1 , args -> child [0 ]);
4574
- }
4575
- if (args -> children >= 2 ) {
4576
- zend_compile_expr (& arg2 , args -> child [1 ]);
4577
- }
4578
- if (args -> children >= 3 ) {
4579
- zend_compile_expr (& arg3 , args -> child [2 ]);
4573
+ znode arg_zvs [3 ];
4574
+ for (uint32_t i = 0 ; i < num_args ; i ++ ) {
4575
+ if (i < args -> children ) {
4576
+ zend_compile_expr (& arg_zvs [i ], args -> child [i ]);
4577
+ } else {
4578
+ zend_internal_arg_info * arg_info = (zend_internal_arg_info * )& fbc -> common .arg_info [i ];
4579
+ arg_zvs [i ].op_type = IS_CONST ;
4580
+ if (zend_get_default_from_internal_arg_info (& arg_zvs [i ].u .constant , arg_info ) == FAILURE ) {
4581
+ ZEND_UNREACHABLE ();
4582
+ }
4583
+ }
4580
4584
}
4581
- uint8_t opcode = ZEND_FRAMELESS_ICALL_0 + args -> children ;
4585
+ uint8_t opcode = ZEND_FRAMELESS_ICALL_0 + num_args ;
4582
4586
zend_op * opline = zend_emit_op_tmp (result , opcode , NULL , NULL );
4583
4587
opline -> extended_value = offset ;
4584
- if (args -> children >= 1 ) {
4585
- SET_NODE (opline -> op1 , & arg1 );
4588
+ if (num_args >= 1 ) {
4589
+ SET_NODE (opline -> op1 , & arg_zvs [ 0 ] );
4586
4590
}
4587
- if (args -> children >= 2 ) {
4588
- SET_NODE (opline -> op2 , & arg2 );
4591
+ if (num_args >= 2 ) {
4592
+ SET_NODE (opline -> op2 , & arg_zvs [ 1 ] );
4589
4593
}
4590
- if (args -> children >= 3 ) {
4591
- zend_emit_op_data (& arg3 );
4594
+ if (num_args >= 3 ) {
4595
+ zend_emit_op_data (& arg_zvs [ 2 ] );
4592
4596
}
4593
4597
return SUCCESS ;
4594
4598
}
0 commit comments