mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
In debug mode, under CLI don't close stderr.
This is so that we can see any error reports. # for extra paranoia, could limit this check to happen only after the script is # finished running.
This commit is contained in:
parent
32956a25bf
commit
c6dff79138
1 changed files with 9 additions and 0 deletions
|
@ -428,7 +428,16 @@ static int php_stdiop_close(php_stream *stream, int close_handle TSRMLS_DC)
|
|||
data->file = NULL;
|
||||
}
|
||||
} else if (data->fd != -1) {
|
||||
#ifdef DEBUG
|
||||
if (data->fd == 2 && strcmp(sapi_module.name, "cli")) {
|
||||
/* don't close stderr in CLI in DEBUG mode, as we want to see any leaks */
|
||||
ret = 0;
|
||||
} else {
|
||||
ret = close(data->fd);
|
||||
}
|
||||
#else
|
||||
ret = close(data->fd);
|
||||
#endif
|
||||
data->fd = -1;
|
||||
} else {
|
||||
return 0; /* everything should be closed already -> success */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue