@@ -33,6 +33,20 @@ ZEND_API zend_class_entry *zend_ce_stringable;
3333/* {{{ zend_call_method
3434 Only returns the returned zval if retval_ptr != NULL */
3535ZEND_API zval * zend_call_method (zend_object * object , zend_class_entry * obj_ce , zend_function * * fn_proxy , const char * function_name , size_t function_name_len , zval * retval_ptr , int param_count , zval * arg1 , zval * arg2 )
36+ {
37+ zend_string * function_name_str ;
38+ zval * retval ;
39+
40+ function_name_str = zend_string_init (function_name , function_name_len , 0 );
41+ retval = zend_call_method_ex (object , obj_ce , fn_proxy , function_name_str , retval_ptr , param_count , arg1 , arg2 );
42+ zend_string_free (function_name_str );
43+
44+ return retval ;
45+ }
46+ /* }}} */
47+
48+ /* {{{ zend_call_method_ex */
49+ ZEND_API zval * zend_call_method_ex (zend_object * object , zend_class_entry * obj_ce , zend_function * * fn_proxy , zend_string * function_name , zval * retval_ptr , int param_count , zval * arg1 , zval * arg2 )
3650{
3751 int result ;
3852 zend_fcall_info fci ;
@@ -56,9 +70,8 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z
5670 if (!fn_proxy && !obj_ce ) {
5771 /* no interest in caching and no information already present that is
5872 * needed later inside zend_call_function. */
59- ZVAL_STRINGL (& fci .function_name , function_name , function_name_len );
73+ ZVAL_STR (& fci .function_name , function_name );
6074 result = zend_call_function (& fci , NULL );
61- zval_ptr_dtor (& fci .function_name );
6275 } else {
6376 zend_fcall_info_cache fcic ;
6477 ZVAL_UNDEF (& fci .function_name ); /* Unused */
@@ -68,17 +81,16 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z
6881 }
6982 if (!fn_proxy || !* fn_proxy ) {
7083 if (EXPECTED (obj_ce )) {
71- fcic .function_handler = zend_hash_str_find_ptr (
72- & obj_ce -> function_table , function_name , function_name_len );
84+ fcic .function_handler = zend_hash_find_ptr (& obj_ce -> function_table , function_name );
7385 if (UNEXPECTED (fcic .function_handler == NULL )) {
7486 /* error at c-level */
75- zend_error_noreturn (E_CORE_ERROR , "Couldn't find implementation for method %s::%s" , ZSTR_VAL (obj_ce -> name ), function_name );
87+ zend_error_noreturn (E_CORE_ERROR , "Couldn't find implementation for method %s::%s" , ZSTR_VAL (obj_ce -> name ), ZSTR_VAL ( function_name ) );
7688 }
7789 } else {
78- fcic .function_handler = zend_fetch_function_str (function_name , function_name_len );
90+ fcic .function_handler = zend_fetch_function (function_name );
7991 if (UNEXPECTED (fcic .function_handler == NULL )) {
8092 /* error at c-level */
81- zend_error_noreturn (E_CORE_ERROR , "Couldn't find implementation for function %s" , function_name );
93+ zend_error_noreturn (E_CORE_ERROR , "Couldn't find implementation for function %s" , ZSTR_VAL ( function_name ) );
8294 }
8395 }
8496 if (fn_proxy ) {
@@ -110,7 +122,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z
110122 obj_ce = object ? object -> ce : NULL ;
111123 }
112124 if (!EG (exception )) {
113- zend_error_noreturn (E_CORE_ERROR , "Couldn't execute method %s%s%s" , obj_ce ? ZSTR_VAL (obj_ce -> name ) : "" , obj_ce ? "::" : "" , function_name );
125+ zend_error_noreturn (E_CORE_ERROR , "Couldn't execute method %s%s%s" , obj_ce ? ZSTR_VAL (obj_ce -> name ) : "" , obj_ce ? "::" : "" , ZSTR_VAL ( function_name ) );
114126 }
115127 }
116128 if (!retval_ptr ) {
@@ -126,7 +138,7 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z
126138/* {{{ zend_user_it_new_iterator */
127139ZEND_API void zend_user_it_new_iterator (zend_class_entry * ce , zval * object , zval * retval )
128140{
129- zend_call_method_with_0_params (Z_OBJ_P (object ), ce , & ce -> iterator_funcs_ptr -> zf_new_iterator , "getiterator" , retval );
141+ zend_call_method_with_0_params_ex (Z_OBJ_P (object ), ce , & ce -> iterator_funcs_ptr -> zf_new_iterator , ZSTR_KNOWN ( ZEND_STR_GET_ITERATOR ) , retval );
130142}
131143/* }}} */
132144
@@ -162,7 +174,7 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter)
162174 zval more ;
163175 int result ;
164176
165- zend_call_method_with_0_params (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_valid , "valid" , & more );
177+ zend_call_method_with_0_params_ex (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_valid , ZSTR_KNOWN ( ZEND_STR_VALID ) , & more );
166178 result = i_zend_is_true (& more );
167179 zval_ptr_dtor (& more );
168180 return result ? SUCCESS : FAILURE ;
@@ -178,7 +190,7 @@ ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter)
178190 zval * object = & iter -> it .data ;
179191
180192 if (Z_ISUNDEF (iter -> value )) {
181- zend_call_method_with_0_params (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_current , "current" , & iter -> value );
193+ zend_call_method_with_0_params_ex (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_current , ZSTR_KNOWN ( ZEND_STR_CURRENT ) , & iter -> value );
182194 }
183195 return & iter -> value ;
184196}
@@ -191,7 +203,7 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
191203 zval * object = & iter -> it .data ;
192204 zval retval ;
193205
194- zend_call_method_with_0_params (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_key , "key" , & retval );
206+ zend_call_method_with_0_params_ex (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_key , ZSTR_KNOWN ( ZEND_STR_KEY ) , & retval );
195207
196208 if (Z_TYPE (retval ) != IS_UNDEF ) {
197209 ZVAL_COPY_VALUE (key , & retval );
@@ -212,7 +224,7 @@ ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter)
212224 zval * object = & iter -> it .data ;
213225
214226 zend_user_it_invalidate_current (_iter );
215- zend_call_method_with_0_params (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_next , "next" , NULL );
227+ zend_call_method_with_0_params_ex (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_next , ZSTR_KNOWN ( ZEND_STR_NEXT ) , NULL );
216228}
217229/* }}} */
218230
@@ -223,7 +235,7 @@ ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter)
223235 zval * object = & iter -> it .data ;
224236
225237 zend_user_it_invalidate_current (_iter );
226- zend_call_method_with_0_params (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_rewind , "rewind" , NULL );
238+ zend_call_method_with_0_params_ex (Z_OBJ_P (object ), iter -> ce , & iter -> ce -> iterator_funcs_ptr -> zf_rewind , ZSTR_KNOWN ( ZEND_STR_REWIND ) , NULL );
227239}
228240/* }}} */
229241
@@ -398,7 +410,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b
398410 zval retval ;
399411 int result ;
400412
401- zend_call_method_with_0_params (Z_OBJ_P (object ), ce , & ce -> serialize_func , "serialize" , & retval );
413+ zend_call_method_with_0_params_ex (Z_OBJ_P (object ), ce , & ce -> serialize_func , ZSTR_KNOWN ( ZEND_STR_SERIALIZE ) , & retval );
402414
403415
404416 if (Z_TYPE (retval ) == IS_UNDEF || EG (exception )) {
@@ -439,7 +451,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns
439451
440452 ZVAL_STRINGL (& zdata , (char * )buf , buf_len );
441453
442- zend_call_method_with_1_params (Z_OBJ_P (object ), ce , & ce -> unserialize_func , "unserialize" , NULL , & zdata );
454+ zend_call_method_with_1_params_ex (Z_OBJ_P (object ), ce , & ce -> unserialize_func , ZSTR_KNOWN ( ZEND_STR_UNSERIALIZE ) , NULL , & zdata );
443455
444456 zval_ptr_dtor (& zdata );
445457
0 commit comments