general signatures discrepencies fixes (#13122)

This commit is contained in:
David CARLIER 2024-01-10 22:19:23 +00:00 committed by GitHub
parent fc16285538
commit 9726721560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 33 additions and 30 deletions

View File

@ -26,6 +26,10 @@ PHP 8.4 INTERNALS UPGRADE NOTES
Z_PARAM_FUNC_EX2 was added as well with the same arguments as Z_PARAM_FUNC_EX
plus an additional argument free_trampoline.
* The zend_object_iterator_funcs valid member has changed its signature from
int(*)(zend_object_iterator *) to zend_result(*)(zend_object_iterator *) to
be more in line with what callbacks are returning.
========================
2. Build system changes
========================

View File

@ -1018,7 +1018,7 @@ static void zend_generator_iterator_dtor(zend_object_iterator *iterator) /* {{{
}
/* }}} */
static int zend_generator_iterator_valid(zend_object_iterator *iterator) /* {{{ */
static zend_result zend_generator_iterator_valid(zend_object_iterator *iterator) /* {{{ */
{
zend_generator *generator = (zend_generator*)Z_OBJ(iterator->data);

View File

@ -198,8 +198,7 @@ ZEND_API HashTable *zend_user_it_get_gc(zend_object_iterator *_iter, zval **tabl
static const zend_object_iterator_funcs zend_interface_iterator_funcs_iterator = {
zend_user_it_dtor,
// FIXME: Adjust the actual function prototype in zend_object_iterator_funcs
(int (*)(zend_object_iterator *)) zend_user_it_valid,
zend_user_it_valid,
zend_user_it_get_current_data,
zend_user_it_get_current_key,
zend_user_it_move_forward,

View File

@ -31,7 +31,7 @@ typedef struct _zend_object_iterator_funcs {
void (*dtor)(zend_object_iterator *iter);
/* check for end of iteration (FAILURE or SUCCESS if data is valid) */
int (*valid)(zend_object_iterator *iter);
zend_result (*valid)(zend_object_iterator *iter);
/* fetch the item data for the current element */
zval *(*get_current_data)(zend_object_iterator *iter);

View File

@ -170,7 +170,7 @@ ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(void)
return LANG_SCNG(script_encoding);
}
ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size)
ZEND_API zend_result zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size)
{
if (CG(script_encoding_list)) {
free((char*)CG(script_encoding_list));

View File

@ -597,7 +597,7 @@ static void zend_weakmap_iterator_dtor(zend_object_iterator *obj_iter)
zval_ptr_dtor(&iter->it.data);
}
static int zend_weakmap_iterator_valid(zend_object_iterator *obj_iter)
static zend_result zend_weakmap_iterator_valid(zend_object_iterator *obj_iter)
{
zend_weakmap_iterator *iter = (zend_weakmap_iterator *) obj_iter;
zend_weakmap *wm = zend_weakmap_fetch(&iter->it.data);

View File

@ -49,7 +49,7 @@ static void com_iter_dtor(zend_object_iterator *iter)
zval_ptr_dtor(&I->zdata);
}
static int com_iter_valid(zend_object_iterator *iter)
static zend_result com_iter_valid(zend_object_iterator *iter)
{
struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data);

View File

@ -455,7 +455,7 @@ static void saproxy_iter_dtor(zend_object_iterator *iter)
efree(I);
}
static int saproxy_iter_valid(zend_object_iterator *iter)
static zend_result saproxy_iter_valid(zend_object_iterator *iter)
{
php_com_saproxy_iter *I = (php_com_saproxy_iter*)Z_PTR(iter->data);

View File

@ -1575,7 +1575,7 @@ static void date_period_it_dtor(zend_object_iterator *iter)
/* }}} */
/* {{{ date_period_it_has_more */
static int date_period_it_has_more(zend_object_iterator *iter)
static zend_result date_period_it_has_more(zend_object_iterator *iter)
{
date_period_it *iterator = (date_period_it *)iter;
php_period_obj *object = Z_PHPPERIOD_P(&iterator->intern.data);

View File

@ -132,7 +132,7 @@ static void php_dom_iterator_dtor(zend_object_iterator *iter) /* {{{ */
}
/* }}} */
static int php_dom_iterator_valid(zend_object_iterator *iter) /* {{{ */
static zend_result php_dom_iterator_valid(zend_object_iterator *iter) /* {{{ */
{
php_dom_iterator *iterator = (php_dom_iterator *)iter;

View File

@ -1933,7 +1933,7 @@ static void zend_ffi_cdata_it_dtor(zend_object_iterator *iter) /* {{{ */
}
/* }}} */
static int zend_ffi_cdata_it_valid(zend_object_iterator *it) /* {{{ */
static zend_result zend_ffi_cdata_it_valid(zend_object_iterator *it) /* {{{ */
{
zend_ffi_cdata_iterator *iter = (zend_ffi_cdata_iterator*)it;
zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ(iter->it.data);

View File

@ -4058,7 +4058,7 @@ static gdIOCtx *create_stream_context(php_stream *stream, int close_stream) {
return ctx;
}
static gdIOCtx *create_output_context() {
static gdIOCtx *create_output_context(void) {
gdIOCtx *ctx = ecalloc(1, sizeof(gdIOCtx));
ctx->putC = _php_image_output_putc;

View File

@ -56,7 +56,7 @@ void zoi_with_current_dtor(zend_object_iterator *iter)
}
}
U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter)
U_CFUNC zend_result zoi_with_current_valid(zend_object_iterator *iter)
{
return Z_ISUNDEF(((zoi_with_current*)iter)->current)? FAILURE : SUCCESS;
}

View File

@ -68,7 +68,7 @@ extern zend_class_entry *IntlIterator_ce_ptr;
extern zend_object_handlers IntlIterator_handlers;
U_CFUNC void zoi_with_current_dtor(zend_object_iterator *iter);
U_CFUNC int zoi_with_current_valid(zend_object_iterator *iter);
U_CFUNC zend_result zoi_with_current_valid(zend_object_iterator *iter);
U_CFUNC zval *zoi_with_current_get_current_data(zend_object_iterator *iter);
U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter);

View File

@ -77,7 +77,7 @@ static void resourcebundle_iterator_dtor( zend_object_iterator *iter )
/* }}} */
/* {{{ resourcebundle_iterator_has_more */
static int resourcebundle_iterator_has_more( zend_object_iterator *iter )
static zend_result resourcebundle_iterator_has_more( zend_object_iterator *iter )
{
ResourceBundle_iterator *iterator = (ResourceBundle_iterator *) iter;
return (iterator->i < iterator->length) ? SUCCESS : FAILURE;

View File

@ -74,7 +74,7 @@ static void php_mysqli_result_iterator_dtor(zend_object_iterator *iter)
/* }}} */
/* {{{ */
static int php_mysqli_result_iterator_valid(zend_object_iterator *iter)
static zend_result php_mysqli_result_iterator_valid(zend_object_iterator *iter)
{
php_mysqli_result_iterator *iterator = (php_mysqli_result_iterator*) iter;

View File

@ -2159,7 +2159,7 @@ static void pdo_stmt_iter_dtor(zend_object_iterator *iter)
}
}
static int pdo_stmt_iter_valid(zend_object_iterator *iter)
static zend_result pdo_stmt_iter_valid(zend_object_iterator *iter)
{
struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter;

View File

@ -47,7 +47,7 @@ static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data);
static xmlNodePtr php_sxe_reset_iterator_no_clear_iter_data(php_sxe_object *sxe, int use_data);
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data);
static void php_sxe_iterator_dtor(zend_object_iterator *iter);
static int php_sxe_iterator_valid(zend_object_iterator *iter);
static zend_result php_sxe_iterator_valid(zend_object_iterator *iter);
static zval *php_sxe_iterator_current_data(zend_object_iterator *iter);
static void php_sxe_iterator_current_key(zend_object_iterator *iter, zval *key);
static void php_sxe_iterator_move_forward(zend_object_iterator *iter);
@ -2462,7 +2462,7 @@ static void php_sxe_iterator_dtor(zend_object_iterator *iter) /* {{{ */
}
/* }}} */
static int php_sxe_iterator_valid(zend_object_iterator *iter) /* {{{ */
static zend_result php_sxe_iterator_valid(zend_object_iterator *iter) /* {{{ */
{
php_sxe_iterator *iterator = (php_sxe_iterator *)iter;

View File

@ -1544,7 +1544,7 @@ static void spl_array_it_dtor(zend_object_iterator *iter) /* {{{ */
}
/* }}} */
static int spl_array_it_valid(zend_object_iterator *iter) /* {{{ */
static zend_result spl_array_it_valid(zend_object_iterator *iter) /* {{{ */
{
spl_array_object *object = Z_SPLARRAY_P(&iter->data);
HashTable *aht = spl_array_get_hash_table(object);

View File

@ -1627,7 +1627,7 @@ PHP_METHOD(GlobIterator, count)
/* {{{ forward declarations to the iterator handlers */
static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter);
static int spl_filesystem_dir_it_valid(zend_object_iterator *iter);
static zend_result spl_filesystem_dir_it_valid(zend_object_iterator *iter);
static zval *spl_filesystem_dir_it_current_data(zend_object_iterator *iter);
static void spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zval *key);
static void spl_filesystem_dir_it_move_forward(zend_object_iterator *iter);
@ -1677,7 +1677,7 @@ static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter)
/* }}} */
/* {{{ spl_filesystem_dir_it_valid */
static int spl_filesystem_dir_it_valid(zend_object_iterator *iter)
static zend_result spl_filesystem_dir_it_valid(zend_object_iterator *iter)
{
spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter);

View File

@ -875,7 +875,7 @@ static void spl_dllist_it_rewind(zend_object_iterator *iter) /* {{{ */
}
/* }}} */
static int spl_dllist_it_valid(zend_object_iterator *iter) /* {{{ */
static zend_result spl_dllist_it_valid(zend_object_iterator *iter) /* {{{ */
{
spl_dllist_it *iterator = (spl_dllist_it *)iter;
spl_ptr_llist_element *element = iterator->traverse_pointer;

View File

@ -895,7 +895,7 @@ static void spl_fixedarray_it_rewind(zend_object_iterator *iter)
((spl_fixedarray_it*)iter)->current = 0;
}
static int spl_fixedarray_it_valid(zend_object_iterator *iter)
static zend_result spl_fixedarray_it_valid(zend_object_iterator *iter)
{
spl_fixedarray_it *iterator = (spl_fixedarray_it*)iter;
spl_fixedarray_object *object = Z_SPLFIXEDARRAY_P(&iter->data);

View File

@ -896,7 +896,7 @@ static void spl_heap_it_rewind(zend_object_iterator *iter) /* {{{ */
}
/* }}} */
static int spl_heap_it_valid(zend_object_iterator *iter) /* {{{ */
static zend_result spl_heap_it_valid(zend_object_iterator *iter) /* {{{ */
{
return ((Z_SPLHEAP_P(&iter->data))->heap->count != 0 ? SUCCESS : FAILURE);
}

View File

@ -210,7 +210,7 @@ static void spl_recursive_it_dtor(zend_object_iterator *_iter)
zval_ptr_dtor(&iter->intern.data);
}
static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthis)
static zend_result spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthis)
{
zend_object_iterator *sub_iter;
int level = object->level;
@ -232,7 +232,7 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi
return FAILURE;
}
static int spl_recursive_it_valid(zend_object_iterator *iter)
static zend_result spl_recursive_it_valid(zend_object_iterator *iter)
{
return spl_recursive_it_valid_ex(Z_SPLRECURSIVE_IT_P(&iter->data), &iter->data);
}
@ -1525,7 +1525,7 @@ static inline void spl_dual_it_rewind(spl_dual_it_object *intern)
}
}
static inline int spl_dual_it_valid(spl_dual_it_object *intern)
static inline zend_result spl_dual_it_valid(spl_dual_it_object *intern)
{
if (!intern->inner.iterator) {
return FAILURE;
@ -2184,7 +2184,7 @@ static zend_object *spl_dual_it_new(zend_class_entry *class_type)
}
/* }}} */
static inline int spl_limit_it_valid(spl_dual_it_object *intern)
static inline zend_result spl_limit_it_valid(spl_dual_it_object *intern)
{
/* FAILURE / SUCCESS */
if (intern->u.limit.count != -1 && intern->current.pos >= intern->u.limit.offset + intern->u.limit.count) {

View File

@ -52,7 +52,7 @@ static void test_traversable_it_next(zend_object_iterator *iter) {
ZVAL_LONG(&iterator->current, Z_LVAL(iterator->current) + 1);
}
static int test_traversable_it_valid(zend_object_iterator *iter) {
static zend_result test_traversable_it_valid(zend_object_iterator *iter) {
DUMP("TraversableTest::valid\n");
test_traversable_it *iterator = test_traversable_it_fetch(iter);
if (Z_LVAL(iterator->current) < 4) {