@@ -812,7 +812,6 @@ static zend_bool can_ct_eval_func_call(zend_string *name, uint32_t num_args, zva
812
812
|| zend_string_equals_literal (name , "str_contains" )
813
813
|| zend_string_equals_literal (name , "str_ends_with" )
814
814
|| zend_string_equals_literal (name , "str_split" )
815
- || zend_string_equals_literal (name , "str_split" )
816
815
|| zend_string_equals_literal (name , "str_starts_with" )
817
816
|| zend_string_equals_literal (name , "strpos" )
818
817
|| zend_string_equals_literal (name , "substr" )
@@ -901,9 +900,8 @@ static zend_bool can_ct_eval_func_call(zend_string *name, uint32_t num_args, zva
901
900
* or just happened to be commonly used with constant operands in WP (need to test other
902
901
* applications as well, of course). */
903
902
static inline int ct_eval_func_call (
904
- 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 ) {
905
904
uint32_t i ;
906
- zend_execute_data * execute_data , * prev_execute_data ;
907
905
zend_function * func = zend_hash_find_ptr (CG (function_table ), name );
908
906
if (!func || func -> type != ZEND_INTERNAL_FUNCTION ) {
909
907
return FAILURE ;
@@ -952,9 +950,20 @@ static inline int ct_eval_func_call(
952
950
return FAILURE ;
953
951
}
954
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
+
955
964
execute_data = safe_emalloc (num_args , sizeof (zval ), ZEND_CALL_FRAME_SLOT * sizeof (zval ));
956
965
memset (execute_data , 0 , sizeof (zend_execute_data ));
957
- prev_execute_data = EG ( current_execute_data ) ;
966
+ execute_data -> prev_execute_data = & dummy_frame ;
958
967
EG (current_execute_data ) = execute_data ;
959
968
960
969
EX (func ) = func ;
@@ -1832,7 +1841,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
1832
1841
break ;
1833
1842
}
1834
1843
1835
- 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 ) {
1836
1845
SET_RESULT (result , & zv );
1837
1846
zval_ptr_dtor_nogc (& zv );
1838
1847
break ;
0 commit comments