Skip to content

Commit f6c0c60

Browse files
committed
Fix GH-11104: STDIN/STDOUT/STDERR is not available for CLI without a script
I found no reason why this is done this way. Of course this will allow users to do stupid stuff like `fclose(STDOUT);` etc. but if they type in that code they clearly know what they're doing... Close GH-11169.
1 parent 001e278 commit f6c0c60

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ PHP NEWS
55
- CLI:
66
. Added pdeathsig to builtin server to terminate workers when the master
77
process is killed. (ilutov)
8+
. Fixed bug GH-11104 (STDIN/STDOUT/STDERR is not available for CLI without
9+
a script). (nielsdos)
810

911
- Core:
1012
. Fixed bug GH-9388 (Improve unset property and __get type incompatibility

sapi/cli/php_cli.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,9 +951,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
951951
PG(during_request_startup) = 0;
952952
switch (behavior) {
953953
case PHP_MODE_STANDARD:
954-
if (script_file) {
955-
cli_register_file_handles();
956-
}
954+
cli_register_file_handles();
957955

958956
if (interactive) {
959957
EG(exit_status) = cli_shell_callbacks.cli_shell_run();

0 commit comments

Comments
 (0)