[php-src] Issue #10995: [PHP 8.2] CLI a prompt in a executed script results in endless input
| From: | remco-pc | Date: | Sun, 02 Apr 2023 13:19:08 +0000 |
| Subject: | [php-src] Issue #10995: [PHP 8.2] CLI a prompt in a executed script results in endless input | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244082@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10995
Author: remco-pc
### Description
The following code:
```php
<?php
$descriptorspec = array(
0 => STDIN, // stdin
1 => STDOUT, // stdout
2 => ["pipe", "w"], // stderr
);
$process = proc_open($command, $descriptorspec, $pipes, Dir::current(), null);
$notification = stream_get_contents($pipes[2]);
fclose($pipes[2]);
return proc_close($process);
```
When using my execute function i have a script which executes another php script.
The executed script inside the script contains a readline ($input = trim(fgets(STDIN));) in PHP
7.4.33 (cli) this is working as expected.
in PHP 8.2.4 (cli) this is not working anymore and i get an endless input stream (and no output from
the executed script).
I had the same in PHP 7.4 with using a pipe for input.
But I expected this output instead:
```
```
### PHP Version
8.2.4
### Operating System
Debian 11.2