|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-12-28 12:40 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 22:00:01 2025 UTC |
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