go to bug id or search bugs for
For some reason, the CLI SAPI doesn't define STDERR and STDIN constants, even though 'php://stderr' and 'php://stdin' still work like you'd expect.
This only affected people without Readline or Libedit.
php 5.5.10 on windows8x64
Add a Patch
Add a Pull Request
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
php -n -r "var_dump(STDIN, STDERR);"
resource(1) of type (stream)
resource(3) of type (stream)
Please post some reproduce way.
run this via CLI SAPI like php -S localhost:8080 and the output is:
Notice: Use of undefined constant STDIN - assumed 'STDIN'
Notice: Use of undefined constant STDERR - assumed 'STDERR'
seems that it does not affect those who have Readline/Libedit compiled with php
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
Thank you for your interest in PHP.
Ah, it is CLI SAPI in the title but that's about the built-in webserver SAPI. There that's fine. STDIN, STDOUT and STDERR are only defined in the CLI SAPI, there is also special handling for CLI. But starting the built-in server you're not it the CLI SAPI anymore, but in the "Apache like" one. While the pure CLI will reuse the predefined stdin, stdout and stderr FILE pointers, the other CLIs expect some predefined file descriptor.
I don't see how can this be related to libreadline and and others.