@@ -900,9 +900,8 @@ static zend_bool can_ct_eval_func_call(zend_string *name, uint32_t num_args, zva
900
900
* or just happened to be commonly used with constant operands in WP (need to test other
901
901
* applications as well, of course). */
902
902
static inline int ct_eval_func_call (
903
- zval * result , zend_string * name , uint32_t num_args , zval * * args ) {
903
+ zend_op_array * op_array , zval * result , zend_string * name , uint32_t num_args , zval * * args ) {
904
904
uint32_t i ;
905
- zend_execute_data * execute_data , * prev_execute_data ;
906
905
zend_function * func = zend_hash_find_ptr (CG (function_table ), name );
907
906
if (!func || func -> type != ZEND_INTERNAL_FUNCTION ) {
908
907
return FAILURE ;
@@ -951,9 +950,20 @@ static inline int ct_eval_func_call(
951
950
return FAILURE ;
952
951
}
953
952
953
+ zend_execute_data * prev_execute_data = EG (current_execute_data );
954
+ zend_execute_data * execute_data , dummy_frame ;
955
+ zend_op dummy_opline ;
956
+
957
+ /* Add a dummy frame to get the correct strict_types behavior. */
958
+ memset (& dummy_frame , 0 , sizeof (zend_execute_data ));
959
+ memset (& dummy_opline , 0 , sizeof (zend_op ));
960
+ dummy_frame .func = (zend_function * ) op_array ;
961
+ dummy_frame .opline = & dummy_opline ;
962
+ dummy_opline .opcode = ZEND_DO_FCALL ;
963
+
954
964
execute_data = safe_emalloc (num_args , sizeof (zval ), ZEND_CALL_FRAME_SLOT * sizeof (zval ));
955
965
memset (execute_data , 0 , sizeof (zend_execute_data ));
956
- prev_execute_data = EG ( current_execute_data ) ;
966
+ execute_data -> prev_execute_data = & dummy_frame ;
957
967
EG (current_execute_data ) = execute_data ;
958
968
959
969
EX (func ) = func ;
@@ -1831,7 +1841,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
1831
1841
break ;
1832
1842
}
1833
1843
1834
- if (ct_eval_func_call (& zv , Z_STR_P (name ), call -> num_args , args ) == SUCCESS ) {
1844
+ if (ct_eval_func_call (scdf -> op_array , & zv , Z_STR_P (name ), call -> num_args , args ) == SUCCESS ) {
1835
1845
SET_RESULT (result , & zv );
1836
1846
zval_ptr_dtor_nogc (& zv );
1837
1847
break ;
0 commit comments