Let extensions accept Io\Poll\Handle objects - #23810
Closed
nicolas-grekas wants to merge 1 commit into
Closed
nicolas-grekas wants to merge 1 commit into
nicolas-grekas wants to merge 1 commit into
Conversation
This was referenced Sep 21, 2026
TimWolla
reviewed
Sep 21, 2026
php_poll.h exports php_poll_handle_get_fd() and the handle object struct, but not the class entry of the interface, so an extension cannot check that an object is a handle before running PHP_POLL_HANDLE_OBJ_FROM_ZV() on it without looking the class up by name. Export the entry and a resolver for parameters that accept more than a handle. php_poll_handle_default_ops was declared without PHPAPI, so an extension providing its own handle type could not link it on Windows.
nicolas-grekas
force-pushed
the
io-poll-extension-api
branch
from
September 21, 2026 09:10
b26aaa3 to
40f3a6b
Compare
Member
|
It might be too late for this and I'd rather not expose it yet for other extensions. It's specifically meant for the poll API at this stage. |
Member
|
Just to clarify the reason here - it's because I plan to introduce some other handle types for 8.7 and I would like to make sure that the internal API is consistent because not all of them will support fd's so it might need a bit of considering to make sure that things are right. |
Contributor
Author
|
Works for me. Note that it seams ext-ev / ext-event might be dead and while ext-uv might be well supported, I don't know maintainer's plan for 8.6 (see amphp/ext-uv#120 & amphp/ext-uv#121) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
php_poll.hexportsphp_poll_handle_get_fd()and the handle object struct under "utility functions for extensions", but not the class entry ofIo\Poll\Handle, so an extension cannot check that an object is a handle before runningPHP_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:What it is for: ext-ev, ext-event and ext-uv could then take an
Io\Poll\Handlewhere 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 notIo\Poll. That is the alternative to handing the descriptor to userland, which is what #23792 removes.php_poll_handle_default_opswas declared withoutPHPAPItoo, so an extension providing its own handle type cannot link it on Windows./cc @bukka