From: chris at ex-parrot dot com Operating system: OS-independent PHP version: 4.3.10 PHP Bug Type: CGI related Bug description: Opening the php://stderr etc. streams in FastCGI mode should open FCGI streams
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 bug report at http://bugs.php.net/?id=31472&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31472&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31472&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31472&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31472&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31472&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31472&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31472&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31472&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31472&r=support Expected behavior: http://bugs.php.net/fix.php?id=31472&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31472&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31472&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31472&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31472&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31472&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31472&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31472&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31472&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31472&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31472&r=mysqlcfg