Skip to content

Stdlib: socket_select() via poll(2) thin FFI (#6395) - #19390

Merged
PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-socket-select-6395
Jul 16, 2026
Merged

Stdlib: socket_select() via poll(2) thin FFI (#6395)#19390
PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-socket-select-6395

Conversation

@PurHur

@PurHur PurHur commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement socket_select() in ext/sockets (VM) using thin libc poll(2) via SocketsLibcThinAbi — no new runtime/ C and no host socket_select delegation.
  • By-ref $read/$write/$except write-back, Zend TypeError/ValueError messages, zero-timeout idle/ready on socket_create_pair.
  • php-src ref: ext/sockets/sockets.c PHP_FUNCTION(socket_select).

Closes #6395

Test plan

  • Issue repro (Zend + VM):
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/issue_6395_socket_select.php
php bin/vm.php test/repro/issue_6395_socket_select.php'
true
idle=0 remaining=0
ready=1 remaining=1
data='hi'
TypeError: … must only have elements of type Socket, string given
  • vendor/bin/phpunit test/compliance/VMTest.php --filter stdlib/socket_select OK
  • BuiltinByRefParamsTest::testSocketSelectArraysByRef OK
  • JIT deferred (same pattern as socket_set_nonblock / socket_create_pair)

Made with Cursor

Register socket_select with by-ref array write-back and Socket element
guards, multiplexing owned fds through SocketsLibcThinAbi::poll.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 0d04c39 into master Jul 16, 2026
@PurHur
PurHur deleted the agent/advanced-stdlib-socket-select-6395 branch July 16, 2026 01:50
PurHur added a commit that referenced this pull request Jul 16, 2026
#19390 landed socket_select on the vm.php inventory path without a
compiler_lib_spine_smoke require, which red-failed spine-coverage and
north-star5-verify-fast. Sync inventory doc to 5030/5030.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Jul 16, 2026
…19399) (#19402)

Deferred user-script AOT still cannot nested-compile PregJitHelper (#16075);
keep the thin preg_* stubs but house them in ext/standard so lib/JIT/Builtin
shrinks. Also add socket_select.php to the spine (trust gate after #19390).

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: socket_select() — ext/sockets multiplexing API missing (ext/sockets/sockets.c)

1 participant