You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed listen() on a tcp:// server reported as success with ext/openssl #24220
The quoted description below was written with an LLM (Claude). I reviewed it, and ran the checks it describes myself.
Description
With ext/openssl loaded, stream_socket_server() on a tcp:// address returns a stream even when listen() fails. The stream is not listening, so the error only shows later, when accepting.
php_openssl_sockop_set_option() handles STREAM_XPORT_OP_LISTEN since TLS session resumption was added (#20296):
caseSTREAM_XPORT_OP_LISTEN:
/* Do normal listen first */xparam->outputs.returncode=php_stream_socket_ops.set_option(
stream, option, value, ptrparam);
php_stream_socket_ops.set_option() stores the result of listen() in xparam->outputs.returncode, and returns PHP_STREAM_OPTION_RETURN_OK because it handled the option. Assigning that return value overwrites the -1 of a failed listen() with 0.
In practice, bind() usually fails first, for example on an address in use. So this needs listen() itself to fail. On Linux, strace can make it fail:
Activity
Fix phpGH-24220: Failed listen() on a tcp:// server reported as success