Skip to content

Commit 2bfbb16

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 1495882 + 5acedab commit 2bfbb16

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

ext/spl/php_spl.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,11 +975,9 @@ static const zend_function_entry spl_functions[] = {
975975
PHP_FE(class_uses, arginfo_class_uses)
976976
PHP_FE(spl_object_hash, arginfo_spl_object_hash)
977977
PHP_FE(spl_object_id, arginfo_spl_object_id)
978-
#ifdef SPL_ITERATORS_H
979978
PHP_FE(iterator_to_array, arginfo_iterator_to_array)
980979
PHP_FE(iterator_count, arginfo_iterator)
981980
PHP_FE(iterator_apply, arginfo_iterator_apply)
982-
#endif /* SPL_ITERATORS_H */
983981
PHP_FE_END
984982
};
985983
/* }}} */

ext/spl/spl_iterators.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3532,11 +3532,7 @@ PHP_FUNCTION(iterator_to_array)
35323532
}
35333533

35343534
array_init(return_value);
3535-
3536-
if (spl_iterator_apply(obj, use_keys ? spl_iterator_to_array_apply : spl_iterator_to_values_apply, (void*)return_value) != SUCCESS) {
3537-
zval_ptr_dtor(return_value);
3538-
RETURN_NULL();
3539-
}
3535+
spl_iterator_apply(obj, use_keys ? spl_iterator_to_array_apply : spl_iterator_to_values_apply, (void*)return_value);
35403536
} /* }}} */
35413537

35423538
static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser) /* {{{ */
@@ -3557,9 +3553,11 @@ PHP_FUNCTION(iterator_count)
35573553
RETURN_FALSE;
35583554
}
35593555

3560-
if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count) == SUCCESS) {
3561-
RETURN_LONG(count);
3556+
if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count) == FAILURE) {
3557+
return;
35623558
}
3559+
3560+
RETURN_LONG(count);
35633561
}
35643562
/* }}} */
35653563

@@ -3598,12 +3596,13 @@ PHP_FUNCTION(iterator_apply)
35983596

35993597
apply_info.count = 0;
36003598
zend_fcall_info_args(&apply_info.fci, apply_info.args);
3601-
if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info) == SUCCESS) {
3602-
RETVAL_LONG(apply_info.count);
3603-
} else {
3604-
RETVAL_FALSE;
3599+
if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info) == FAILURE) {
3600+
zend_fcall_info_args(&apply_info.fci, NULL);
3601+
return;
36053602
}
3603+
36063604
zend_fcall_info_args(&apply_info.fci, NULL);
3605+
RETURN_LONG(apply_info.count);
36073606
}
36083607
/* }}} */
36093608

0 commit comments

Comments
 (0)