Category
stdlib
Problem
Zend exposes stream_isatty($stream): bool to detect whether a stream resource is connected to a terminal. This compiler reports function_exists('stream_isatty') → false on bin/vm.php; scripts using CLI prompts, progress bars, or color libraries cannot branch on TTY availability.
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(\"stream_isatty\")); echo \"\\n\"; try { var_export(stream_isatty(STDIN)); } catch (Throwable \$e) { echo get_class(\$e); }"'
Observed (VM):
false
# undefined function on stream_isatty(STDIN)
Zend PHP expected: function_exists → true; stream_isatty(STDIN) → bool; non-resource → TypeError.
./script/docker-exec.sh -- bash -lc 'php -r "var_export(function_exists(\"stream_isatty\"));"'
Scope (this repo)
| Layer |
Path |
Notes |
| Builtin |
ext/standard/stream_isatty.php |
|
| VM helper |
ext/standard/VmStream.php — isTty($resource): bool |
Use stream fd accessor |
| Register |
ext/standard/Module.php |
|
| JIT/AOT |
defer v1 |
Note VM-only in capability matrix |
| Tests |
test/compliance/cases/stdlib/stream_isatty.phpt |
stdin pipe vs tty when harness allows |
PHP-in-PHP first: implement in ext/standard/; thin C ABI in runtime/ only if isatty(3) on native fd is unavoidable for AOT.
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter StreamIsatty'
Links
Category
stdlibProblem
Zend exposes
stream_isatty($stream): boolto detect whether a stream resource is connected to a terminal. This compiler reportsfunction_exists('stream_isatty')→ false onbin/vm.php; scripts using CLI prompts, progress bars, or color libraries cannot branch on TTY availability.php-src reference
ext/standard/streamsfuncs.c—PHP_FUNCTION(stream_isatty)main/streams/php_stream.c—php_stream_isatty()→ platformisatty(3)Repro (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "var_export(function_exists(\"stream_isatty\")); echo \"\\n\"; try { var_export(stream_isatty(STDIN)); } catch (Throwable \$e) { echo get_class(\$e); }"'Observed (VM):
Zend PHP expected:
function_exists→true;stream_isatty(STDIN)→bool; non-resource →TypeError../script/docker-exec.sh -- bash -lc 'php -r "var_export(function_exists(\"stream_isatty\"));"'Scope (this repo)
ext/standard/stream_isatty.phpext/standard/VmStream.php—isTty($resource): boolext/standard/Module.phptest/compliance/cases/stdlib/stream_isatty.phptPHP-in-PHP first: implement in
ext/standard/; thin C ABI inruntime/only ifisatty(3)on native fd is unavoidable for AOT.Done when
function_exists('stream_isatty')istrueon VMstream_isatty(STDIN)returnsboolwithout fatal (value may differ pipe vs tty)TypeErrormatching Zend./script/ci-fast.sh --filter StreamIsattygreendocs/capabilities.mdrow added viascript/capability-matrix.phpVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter StreamIsatty'Links