@@ -3059,9 +3059,9 @@ PHP_FUNCTION(iterator_count)
3059
3059
/* }}} */
3060
3060
3061
3061
typedef struct {
3062
- zend_long count ;
3063
- zend_fcall_info fci ;
3064
- zend_fcall_info_cache fcc ;
3062
+ zend_long count ;
3063
+ HashTable * params_ht ;
3064
+ zend_fcall_info_cache fcc ;
3065
3065
} spl_iterator_apply_info ;
3066
3066
3067
3067
static int spl_iterator_func_apply (zend_object_iterator * iter , void * puser ) /* {{{ */
@@ -3071,7 +3071,7 @@ static int spl_iterator_func_apply(zend_object_iterator *iter, void *puser) /* {
3071
3071
int result ;
3072
3072
3073
3073
apply_info -> count ++ ;
3074
- zend_call_function_with_return_value (& apply_info -> fci , & apply_info -> fcc , & retval );
3074
+ zend_call_known_fcc (& apply_info -> fcc , & retval , 0 , NULL , apply_info -> params_ht );
3075
3075
result = zend_is_true (& retval ) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_STOP ;
3076
3076
zval_ptr_dtor (& retval );
3077
3077
return result ;
@@ -3082,18 +3082,25 @@ static int spl_iterator_func_apply(zend_object_iterator *iter, void *puser) /* {
3082
3082
PHP_FUNCTION (iterator_apply )
3083
3083
{
3084
3084
zval * traversable ;
3085
- spl_iterator_apply_info apply_info ;
3085
+ zend_fcall_info dummy_fci ;
3086
+ spl_iterator_apply_info apply_info = {
3087
+ .count = 0 ,
3088
+ .params_ht = NULL ,
3089
+ .fcc = {},
3090
+ };
3086
3091
3087
3092
/* The HashTable is used to determine positional arguments */
3088
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "Of|h!" , & traversable , zend_ce_traversable ,
3089
- & apply_info .fci , & apply_info .fcc , & apply_info .fci .named_params ) == FAILURE ) {
3093
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "OF|h!" , & traversable , zend_ce_traversable ,
3094
+ & dummy_fci , & apply_info .fcc , & apply_info .params_ht ) == FAILURE ) {
3095
+ zend_release_fcall_info_cache (& apply_info .fcc );
3090
3096
RETURN_THROWS ();
3091
3097
}
3092
3098
3093
- apply_info .count = 0 ;
3094
3099
if (spl_iterator_apply (traversable , spl_iterator_func_apply , (void * )& apply_info ) == FAILURE ) {
3095
- return ;
3100
+ zend_release_fcall_info_cache (& apply_info .fcc );
3101
+ RETURN_THROWS ();
3096
3102
}
3103
+ zend_release_fcall_info_cache (& apply_info .fcc );
3097
3104
RETURN_LONG (apply_info .count );
3098
3105
}
3099
3106
/* }}} */
0 commit comments