[php-src] Issue #11104: STDIN/STDOUT/STDERR is not available for CLI without a script
| From: | jhdxr | Date: | Wed, 19 Apr 2023 19:41:23 +0000 |
| Subject: | [php-src] Issue #11104: STDIN/STDOUT/STDERR is not available for CLI without a script | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244233@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11104
Author: jhdxr
### Description
I ran into this issue when I try to access
STDOUT with
Symfony\Component\Process\PhpProcess
I dig a bit and found out the three stream constants are not available for CLI are not available
without a script or certain options (.e.g -a or -r)
Here is a simplied way to reproduce.
```shell
~> php
<?php var_dump(STDOUT);
<ctrl+d>
```
Resulted in this output:
```
PHP Fatal error: Uncaught Error: Undefined constant "STDOUT" in Standard input code:1
Stack trace:
#0 {main}
thrown in Standard input code on line 1
```
But I expected this output instead:
```
resource(2) of type (stream)
```
I try to trace why there is such constraint but it seems to be there for more than 10 years. Shall
we fix it pr document this behavior?
### PHP Version
PHP 8.2.4
### Operating System
irrelevant