Bug #71229 [Com]: Writing to "php://stdout" from the interactive shell makes it hang
| From: | mehwish dot yati at gmail dot com | Date: | Fri, 18 Jun 2021 03:41:58 +0000 |
| Subject: | Bug #71229 [Com]: Writing to "php://stdout" from the interactive shell makes it hang | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234472@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71229&edit=1
ID: 71229
Comment by: mehwish dot yati at gmail dot com
Reported by: michelezamuner at gmail dot com
Summary: Writing to "php://stdout" from the interactive shell
makes it hang
Status: Assigned
Type: Bug
Package: *General Issues
Operating System: Ubuntu 14.04.1 x86_64
PHP Version: 7.0.1
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
With its auto two-sided printing, you can work efficiently. You may save your tones of time and
paper with its 30-page auto document feeder. Its ink cartridges are durable and can be replaced by
inexpensive individual ink cartridges. To achieve exact laser quality and bright colors, take this
printer in your magnificent label and sticker printers' list.
You can find more guides here https://printerhow.com/best-printer-for-labels/
Previous Comments:
------------------------------------------------------------------------
[2015-12-28 15:13:16] laruence@php.net
An quick fix could be :
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index b4288b8..c2413fa 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -964,7 +964,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
PG(during_request_startup) = 0;
switch (behavior) {
case PHP_MODE_STANDARD:
- if (strcmp(file_handle.filename, "-")) {
+ if (strcmp(file_handle.filename, "-") || interactive) {
cli_register_file_handles();
}
however, I am trying to figure out a better solution
------------------------------------------------------------------------
[2015-12-28 12:40:42] michelezamuner at gmail dot com
Description:
------------
In the interactive shell, after executing a function that writes a string to
"php://stdout" file, the prompt doesn't appear back, and no input from the keyboard
is recognized. The only thing left to do is terminating the process (Ctrl+C) and starting the shell
again.
Test script:
---------------
// Start the interactive shell
// $ php -a
file_put_contents("php://stdout", "Hello, World!");
// The string is correctly printed, but no prompt is available any more,
// and no keyboard input is recognized.
Expected result:
----------------
After printing the expected string (which happens correctly) I expect the prompt "php >
" to be available again, and to be able to continue working with the shell.
Actual result:
--------------
The prompt "php > " doesn't appear after printing the string, and the shell is
frozen, not accepting any input from the keyboard.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71229&edit=1