mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-8827: Intentionally closing std handles no longer possible
We revert the commits which caused this regression from the PHP-8.0 and PHP-8.1 branches for now. We keep it in "master" because of PR #8833 which may offer a proper fix without BC break.
This commit is contained in:
parent
6f87a5c633
commit
a8437d08a8
4 changed files with 9 additions and 28 deletions
|
@ -539,14 +539,6 @@ static void cli_register_file_handles(void) /* {{{ */
|
|||
s_out = php_stream_open_wrapper_ex("php://stdout", "wb", 0, NULL, sc_out);
|
||||
s_err = php_stream_open_wrapper_ex("php://stderr", "wb", 0, NULL, sc_err);
|
||||
|
||||
/* Release stream resources, but don't free the underlying handles. Othewrise,
|
||||
* extensions which write to stderr or company during mshutdown/gshutdown
|
||||
* won't have the expected functionality.
|
||||
*/
|
||||
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);
|
||||
if (s_out) php_stream_close(s_out);
|
||||
|
@ -554,6 +546,12 @@ static void cli_register_file_handles(void) /* {{{ */
|
|||
return;
|
||||
}
|
||||
|
||||
#if PHP_DEBUG
|
||||
/* do not close stdout and stderr */
|
||||
s_out->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
s_err->flags |= PHP_STREAM_FLAG_NO_CLOSE;
|
||||
#endif
|
||||
|
||||
s_in_process = s_in;
|
||||
|
||||
php_stream_to_zval(s_in, &ic.value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue