Merge branch 'PHP-7.4' of git://github.com/php/php-src into PHP-7.4

This commit is contained in:
Derick Rethans 2019-09-03 09:11:00 +01:00
commit ac356ba81f
3 changed files with 20 additions and 13 deletions

View File

@ -412,6 +412,7 @@ static const func_info_t func_infos[] = {
F0("proc_nice", MAY_BE_FALSE | MAY_BE_TRUE),
#endif
F0("rand", MAY_BE_NULL | MAY_BE_LONG),
F1("random_bytes", MAY_BE_STRING),
F0("srand", MAY_BE_NULL),
F0("getrandmax", MAY_BE_NULL | MAY_BE_LONG),
F0("mt_rand", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
@ -848,6 +849,8 @@ static const func_info_t func_infos[] = {
F1("array_chunk", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_combine", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F0("array_key_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
FN("array_key_first", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
FN("array_key_last", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
F1("pos", UNKNOWN_INFO),
F0("sizeof", MAY_BE_NULL | MAY_BE_LONG),
F0("key_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
@ -1207,9 +1210,12 @@ static const func_info_t func_infos[] = {
/* ext/hash */
F1("hash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F0("hash_equals", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("hash_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hmac", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hmac_algos", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("hash_hmac_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hkdf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("hash_update", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("hash_update_stream", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),

View File

@ -237,6 +237,10 @@ PHP_FUNCTION(class_uses)
Return an array containing the names of all clsses and interfaces defined in SPL */
PHP_FUNCTION(spl_classes)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
SPL_LIST_CLASSES(return_value, 0, 0, 0)
@ -983,11 +987,9 @@ static const zend_function_entry spl_functions[] = {
PHP_FE(class_uses, arginfo_class_uses)
PHP_FE(spl_object_hash, arginfo_spl_object_hash)
PHP_FE(spl_object_id, arginfo_spl_object_id)
#ifdef SPL_ITERATORS_H
PHP_FE(iterator_to_array, arginfo_iterator_to_array)
PHP_FE(iterator_count, arginfo_iterator)
PHP_FE(iterator_apply, arginfo_iterator_apply)
#endif /* SPL_ITERATORS_H */
PHP_FE_END
};
/* }}} */

View File

@ -3573,11 +3573,7 @@ PHP_FUNCTION(iterator_to_array)
}
array_init(return_value);
if (spl_iterator_apply(obj, use_keys ? spl_iterator_to_array_apply : spl_iterator_to_values_apply, (void*)return_value) != SUCCESS) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
spl_iterator_apply(obj, use_keys ? spl_iterator_to_array_apply : spl_iterator_to_values_apply, (void*)return_value);
} /* }}} */
static int spl_iterator_count_apply(zend_object_iterator *iter, void *puser) /* {{{ */
@ -3598,9 +3594,11 @@ PHP_FUNCTION(iterator_count)
RETURN_FALSE;
}
if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count) == SUCCESS) {
RETURN_LONG(count);
if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count) == FAILURE) {
return;
}
RETURN_LONG(count);
}
/* }}} */
@ -3639,12 +3637,13 @@ PHP_FUNCTION(iterator_apply)
apply_info.count = 0;
zend_fcall_info_args(&apply_info.fci, apply_info.args);
if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info) == SUCCESS) {
RETVAL_LONG(apply_info.count);
} else {
RETVAL_FALSE;
if (spl_iterator_apply(apply_info.obj, spl_iterator_func_apply, (void*)&apply_info) == FAILURE) {
zend_fcall_info_args(&apply_info.fci, NULL);
return;
}
zend_fcall_info_args(&apply_info.fci, NULL);
RETURN_LONG(apply_info.count);
}
/* }}} */