mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix GH-8827: Intentionally closing std handles no longer possible
This commit is contained in:
commit
b8dee9b3fc
4 changed files with 13 additions and 12 deletions
|
@ -542,11 +542,9 @@ static void cli_register_file_handles(bool no_close) /* {{{ */
|
|||
* extensions which write to stderr or company during mshutdown/gshutdown
|
||||
* won't have the expected functionality.
|
||||
*/
|
||||
if (no_close) {
|
||||
if (s_in) s_in->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
if (s_out) s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
if (s_err) s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
}
|
||||
if (s_in) s_in->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
if (s_out) s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
if (s_err) s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
|
||||
if (s_in==NULL || s_out==NULL || s_err==NULL) {
|
||||
if (s_in) php_stream_close(s_in);
|
||||
|
@ -960,7 +958,7 @@ do_repeat:
|
|||
switch (behavior) {
|
||||
case PHP_MODE_STANDARD:
|
||||
if (script_file) {
|
||||
cli_register_file_handles(/* no_close */ true);
|
||||
cli_register_file_handles(/* no_close */ PHP_DEBUG || num_repeats > 1);
|
||||
}
|
||||
|
||||
if (interactive) {
|
||||
|
@ -995,7 +993,7 @@ do_repeat:
|
|||
}
|
||||
break;
|
||||
case PHP_MODE_CLI_DIRECT:
|
||||
cli_register_file_handles(/* no_close */ true);
|
||||
cli_register_file_handles(/* no_close */ PHP_DEBUG || num_repeats > 1);
|
||||
zend_eval_string_ex(exec_direct, NULL, "Command line code", 1);
|
||||
break;
|
||||
|
||||
|
@ -1010,7 +1008,7 @@ do_repeat:
|
|||
file_handle.filename = NULL;
|
||||
}
|
||||
|
||||
cli_register_file_handles(/* no_close */ true);
|
||||
cli_register_file_handles(/* no_close */ PHP_DEBUG || num_repeats > 1);
|
||||
|
||||
if (exec_begin) {
|
||||
zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue