Skip to content

general signatures discrepencies #13122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -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
========================
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_generators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions Zend/zend_interfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_iterators.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment on lines 33 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should have an entry in UPGRADING.INTERNALS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true true :)


/* fetch the item data for the current element */
zval *(*get_current_data)(zend_object_iterator *iter);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_multibyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_weakrefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_saproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/dom_iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ext/ffi/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/common/common_enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/common/common_enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ext/intl/resourcebundle/resourcebundle_iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqli/mysqli_result_iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions ext/simplexml/simplexml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ext/spl/spl_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_dllist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_fixedarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions ext/spl/spl_iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion ext/zend_test/iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down