[php-src] PR #23810: Let extensions accept Io\Poll\Handle objects

From: Date: Mon, 21 Sep 2026 07:57:00 +0000
Subject: [php-src] PR #23810: Let extensions accept Io\Poll\Handle objects
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38651@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23810 Author: nicolas-grekas php_poll.h exports php_poll_handle_get_fd() and the handle object struct under "utility functions for extensions", but not the class entry of Io\Poll\Handle, so an extension cannot check that an object is a handle before running PHP_POLL_HANDLE_OBJ_FROM_ZV() on it, other than by looking the class up by name. This exports the entry, plus a resolver for the common case of a parameter that takes more than a handle: ```c php_poll_handle_object *handle = php_poll_handle_from_zval(zv); if (handle != NULL) { php_socket_t fd = php_poll_handle_get_fd(handle); } ``` What it is for: ext-ev, ext-event and ext-uv could then take an Io\Poll\Handle where they take a stream or a descriptor today, resolve it in C and keep a reference to the handle while they watch it, so a handle provided by an extension works with the event loops that are not Io\Poll. That is the alternative to handing the descriptor to userland, which is what #23792 removes. php_poll_handle_default_ops was declared without PHPAPI too, so an extension providing its own handle type cannot link it on Windows. /cc @bukka

« previous php.git-pulls (#38651) next »