## Category `stdlib` ## Problem `fopen` / `fread` / `stream_context_create` exist, but callers cannot introspect or configure open streams: - `stream_get_meta_data($fp)` — uri, mode, timed_out, blocked, etc. - `stream_set_blocking($fp, bool)` — toggle blocking I/O HTTP clients, subprocess pipes (**#3131**), and socket code (**#3202**) depend on these. ## php-src reference - `ext/standard/streams.c` — `php_stream_get_meta_data`, `php_stream_set_blocking` - `main/streams/streams.c` — `php_stream` metadata fields - `ext/standard/basic_functions.c` — registration ## Repro (today) ```bash ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh php bin/vm.php -r "var_dump(function_exists(\"stream_get_meta_data\"));" php bin/vm.php -r "\$f = fopen(\"php://memory\", \"r+\"); var_dump(stream_get_meta_data(\$f));" ' ``` **Zend PHP:** `bool(true)`; array with `stream_type`, `mode`, `uri`, … **This compiler:** undefined function / fatal on first line ## Scope (this repo) | Layer | Files | Notes | |-------|-------|-------| | VM | `ext/standard/stream_get_meta_data.php`, `stream_set_blocking.php`, `VmStream.php` | Map FILE* / memory streams to meta array | | Module | `ext/standard/Module.php` | Register both | | Resource | existing fopen resource type | Attach path/mode at open time | | JIT | defer | VM-only v1 | | Tests | `test/compliance/cases/stream_get_meta_data.phpt` | `php://memory`, temp file | **v1 keys (minimum):** `uri`, `mode`, `stream_type`, `wrapper_type`, `seekable`, `timed_out`, `blocked`, `eof`. ## Done when - [ ] `stream_get_meta_data(fopen('php://memory','r+'))` returns expected keys on VM - [ ] `stream_set_blocking` toggles `blocked` key (best-effort on files) - [ ] Invalid resource: warning + `false` - [ ] `./script/ci-fast.sh --filter stream_get_meta` green ## Verification ```bash ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter stream_get_meta' ``` ## Dependencies - **#3202** sockets — reuse meta shape for `stream_socket_client` resources - **#3131** `proc_open` — pipe blocking ## Links - **#1492** bootstrap may inspect compile artifacts via streams
Activity
PurHur commentedon Jun 5, 2026
Duplicate of #6007 (same stream_get_meta_data/stream_set_blocking scope, newer spec with repro path). Closing to reduce queue noise.