Skip to content

Stdlib: stream_socket_accept() missing — TCP server accept on stream resource fatal (ext/standard/streamsfuncs.c) #15346

Closed

Description

@PurHur

Category

stdlib · php-src-strict · stream sockets phase 2

Problem

stream_socket_server() / stream_socket_client() exist (#3202), but stream_socket_accept() is not registered — function_exists('stream_socket_accept') is false on VM while Zend returns true. Blocking TCP servers and test harnesses cannot accept connections on stream resources.

Related cluster: #6043 (shutdown/get_name/UDP), #4610 (stream_socket_enable_crypto).

Verified 2026-07-03 on master.

php-src reference

PHP implementation target

  • ext/standard/ stream socket builtin (PHP lowering + thin accept(2) ABI if needed)
  • Reuse existing stream resource wrappers from stream_socket_server()

Repro

test/repro/maintainer_gap_stream_socket_accept.php

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_stream_socket_accept.php'           # true
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_stream_socket_accept.php'  # undefined function

Done when (php-src-strict)

  • Repro prints true on VM
  • Timeout / invalid-server-resource errors match Zend
  • Capability matrix lists stream_socket_accept VM=yes

Links

North star #1492 · #3202 · #6043

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    area:webWeb / CGI / superglobals
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 3, 2026
  2. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  3. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    Merged via #15351.

    Verification (docker-exec):

    php bin/vm.php test/repro/maintainer_gap_stream_socket_accept.php  # true / true / peer-ok
    php bin/compile.php -l test/repro/maintainer_gap_stream_socket_accept.php  # exit 0
    ./vendor/bin/phpunit --filter stream_socket_accept  # OK (VM + JIT)

    PHP impl: ext/standard/VmStreamSocketAcceptPure.php (host accept on adopted server stream). php-src ref: ext/standard/streamsfuncs.c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinearea:webWeb / CGI / superglobalsenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions