Commit a3ef478bd1a for php.net
commit a3ef478bd1ab51aa50fbf89526a7f135ece876a3
Author: Ilija Tovilo <ilija.tovilo@me.com>
Date: Sat Jun 20 15:15:34 2026 +0200
Move decls into ZEND_HASH_FOREACH macros in poll API
diff --git a/ext/standard/io_poll.c b/ext/standard/io_poll.c
index c048d43ccb4..b1eb7513f1c 100644
--- a/ext/standard/io_poll.c
+++ b/ext/standard/io_poll.c
@@ -91,7 +91,6 @@ static uint32_t php_io_poll_event_enum_to_bit(zend_object *event_enum)
static uint32_t php_io_poll_event_enums_to_events(zval *event_enums)
{
HashTable *ht;
- zval *entry;
uint32_t events = 0;
if (Z_TYPE_P(event_enums) != IS_ARRAY) {
@@ -100,7 +99,7 @@ static uint32_t php_io_poll_event_enums_to_events(zval *event_enums)
ht = Z_ARRVAL_P(event_enums);
- ZEND_HASH_FOREACH_VAL(ht, entry) {
+ ZEND_HASH_FOREACH_VAL(ht, zval *entry) {
if (Z_TYPE_P(entry) != IS_OBJECT
|| !instanceof_function(Z_OBJCE_P(entry), php_io_poll_event_class_entry)) {
return 0;
@@ -297,8 +296,7 @@ static void php_io_poll_context_free_object(zend_object *obj)
php_io_poll_context_object *intern = PHP_POLL_CONTEXT_OBJ_FROM_ZOBJ(obj);
if (intern->watchers) {
- zval *zv;
- ZEND_HASH_FOREACH_VAL(intern->watchers, zv) {
+ ZEND_HASH_FOREACH_VAL(intern->watchers, zval *zv) {
php_io_poll_watcher_object *watcher = PHP_POLL_WATCHER_OBJ_FROM_ZOBJ(Z_OBJ_P(zv));
watcher->active = false;
watcher->poll_ctx = NULL;
@@ -337,8 +335,7 @@ static HashTable *php_io_poll_context_get_gc(zend_object *obj, zval **table, int
zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create();
if (intern->watchers) {
- zval *zv;
- ZEND_HASH_FOREACH_VAL(intern->watchers, zv) {
+ ZEND_HASH_FOREACH_VAL(intern->watchers, zval *zv) {
zend_get_gc_buffer_add_zval(gc_buffer, zv);
} ZEND_HASH_FOREACH_END();
}
diff --git a/main/poll/poll_backend_kqueue.c b/main/poll/poll_backend_kqueue.c
index 3d8e1feb473..59b5efa9cac 100644
--- a/main/poll/poll_backend_kqueue.c
+++ b/main/poll/poll_backend_kqueue.c
@@ -420,10 +420,8 @@ static int kqueue_backend_wait(
if (garbage_events > 0) {
/* Clean up orphaned filters from complete oneshot FDs */
- zend_ulong fd_key;
- zval *tracking;
struct kevent cleanup_change;
- ZEND_HASH_FOREACH_NUM_KEY_VAL(backend_data->fd_tracking, fd_key, tracking)
+ ZEND_HASH_FOREACH_NUM_KEY_VAL(backend_data->fd_tracking, zend_ulong fd_key, zval *tracking)
{
zend_long flags = Z_LVAL_P(tracking);
if (flags & KQUEUE_FD_HAS_GARBAGE) {
diff --git a/main/poll/poll_fd_table.c b/main/poll/poll_fd_table.c
index 97231072322..1c76da79b7e 100644
--- a/main/poll/poll_fd_table.c
+++ b/main/poll/poll_fd_table.c
@@ -34,9 +34,7 @@ php_poll_fd_table *php_poll_fd_table_init(int initial_capacity, bool persistent)
void php_poll_fd_table_cleanup(php_poll_fd_table *table)
{
if (table) {
- zval *zv;
-
- ZEND_HASH_FOREACH_VAL(&table->entries_ht, zv)
+ ZEND_HASH_FOREACH_VAL(&table->entries_ht, zval *zv)
{
php_poll_fd_entry *entry = Z_PTR_P(zv);
pefree(entry, table->persistent);
@@ -105,10 +103,7 @@ typedef bool (*php_poll_fd_iterator_func_t)(int fd, php_poll_fd_entry *entry, vo
void php_poll_fd_table_foreach(
php_poll_fd_table *table, php_poll_fd_iterator_func_t callback, void *user_data)
{
- zend_ulong fd;
- zval *zv;
-
- ZEND_HASH_FOREACH_NUM_KEY_VAL(&table->entries_ht, fd, zv)
+ ZEND_HASH_FOREACH_NUM_KEY_VAL(&table->entries_ht, zend_ulong fd, zval *zv)
{
php_poll_fd_entry *entry = Z_PTR_P(zv);
if (entry->active && !callback((int) fd, entry, user_data)) {