Req #31472 [Opn->Csd]: Opening the php://stderr etc. streams in FastCGI mode should open FCGI streams
| From: | ilutov@php.net | Date: | Fri, 08 Apr 2022 08:17:18 +0000 |
| Subject: | Req #31472 [Opn->Csd]: Opening the php://stderr etc. streams in FastCGI mode should open FCGI streams | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-240803@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=31472&edit=1
ID: 31472
Updated by: ilutov@php.net
Reported by: chris at ex-parrot dot com
Summary: Opening the php://stderr etc. streams in FastCGI
mode should open FCGI streams
-Status: Open
+Status: Closed
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: *
PHP Version: 5CVS, 4CVS (2005-01-10)
-Assigned To:
+Assigned To: ilutov
Block user comment: N
Private report: N
New Comment:
Not sure if this is still relevant. If it is, please create a new issue on GitHub.
Previous Comments:
------------------------------------------------------------------------
[2005-01-10 16:14:08] chris at ex-parrot dot com
Description:
------------
Opening the "php://stderr" stream and writing to it in FastCGI mode writes to the FCGI
server's standard error, not the multiplexed request standard error stream.
Reproduce code:
---------------
$stderr = fopen("php://stderr", "w");
fputs($stderr, "fish soup is good for you");
Expected result:
----------------
This should log an error message to the server's error log when the script is running in a web
server environment. (Note that error_log can't necessarily be used in this context, because it
always appends a "\n" to anything you send, and is also affected by the configuration
file.)
Actual result:
--------------
Under FastCGI mode, it doesn't log such a message, but instead writes it to the FGGI
*server's* standard error stream, which isn't the same thing at all. The message should be
written via the multiplexed FastCGI error stream, not to fd #2.
(See also a related bug, http://bugs.php.net/bug.php?id=28074 , which
I've fixed.)
Basically this is simple but a bit messy to fix. In ext/standard/php_fopen_wrapper.c the
php://stderr case (and possibly the other ones) need to be treated specially in the FastCGI case,
defining new stream output operations for the FastCGI streams.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=31472&edit=1