|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31472 Opening the php://stderr etc. streams in FastCGI mode should open FCGI streams
Submitted: 2005-01-10 16:14 UTC Modified: 2007-07-24 15:36 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: chris at ex-parrot dot com Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5CVS, 4CVS (2005-01-10) OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: chris at ex-parrot dot com
New email:
PHP Version: OS:


 [2005-01-10 16:14 UTC] chris at ex-parrot dot com
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, , 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.


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 02:03:34 2021 UTC