Category
stdlib
Problem
Low-level BSD socket API (socket_create, socket_connect, socket_read, socket_write, socket_close, …) is missing. function_exists('socket_create') is false on VM.
Web and CLI networking stacks in php-src depend on ext/sockets (distinct from fsockopen streams in #3384).
php-src reference
Repro (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "var_export(function_exists(\"socket_create\"));"'
# bool(false)
Zend with ext/sockets enabled: bool(true).
Minimal TCP client (after implementation):
<?php
$s = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($s, '127.0.0.1', 9); // discard port — connection may fail; API must exist
socket_close($s);
echo "ok\n";
Scope (this repo)
| Module |
Path |
| Extension |
ext/sockets/ (new Module.php, VM wrappers) |
| VM streams |
lib/VM.php or dedicated socket resource handle |
| Register |
root module loader + script/capability-matrix.php |
| Tests |
test/compliance/cases/stdlib/socket_create_basic.phpt (loopback or mock) |
| JIT/AOT |
phase 2 — VM-first |
Done when
Links
Category
stdlibProblem
Low-level BSD socket API (
socket_create,socket_connect,socket_read,socket_write,socket_close, …) is missing.function_exists('socket_create')is false on VM.Web and CLI networking stacks in php-src depend on
ext/sockets(distinct fromfsockopenstreams in #3384).php-src reference
ext/sockets/sockets.c—PHP_FUNCTION(socket_create),socket_connect,socket_read,socket_writeext/sockets/php_sockets.h—php_socketresource typemain/php_network.h— address helpers shared with streamsRepro (failure today)
Zend with
ext/socketsenabled:bool(true).Minimal TCP client (after implementation):
Scope (this repo)
ext/sockets/(newModule.php, VM wrappers)lib/VM.phpor dedicated socket resource handlescript/capability-matrix.phptest/compliance/cases/stdlib/socket_create_basic.phpt(loopback or mock)Done when
socket_create/socket_closeregistered; reprofunction_existstrueAF_INET+SOCK_STREAM+socket_connect+socket_write/socket_readon loopback matches Zend error semantics when peer absent./script/ci-fast.sh --filter socketgreenLinks
fsockopen) · web north-star 🗺️ ROADMAP: Self-host + web-capable PHP subset (living) #78 · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492