# STDOUT, STDERR not defined in CLI mode

- Thread: https://externals.io/message/3826
- Original archive: https://news-web.php.net/php.internals/3826
- Started by Alex Kiesel on 2003-08-08T11:43:57+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #3826 — Alex Kiesel — 2003-08-08T11:43:57+00:00

URL: https://externals.io/message/3826#3826

Hi,

sometimes STDIN, `STDOUT` and `STDERR` are not defined in cli mode:

~/cvs/php/php-src# ./sapi/cli/php -r 'var_dump (STDERR);'
resource(3) of type (stream)

~/cvs/php/php-src# echo '<?php var_dump(STDERR); ?> ' | ./sapi/cli/php 
string(6) "STDERR"

The attached patch removes the check for the scripts filename and always
registeres the STD*-constants in PHP_MODE_STANDARD.

Certainly it does not make sense to read from `STDIN` when called the
second way, but it may be necessary to have `STDOUT` and `STDERR` defined. 

Also, accessing `STDIN` does not lead to segfaults or other oddities.

- Alex
