From: ch at hoffie dot info Operating system: Linux PHP version: 5CVS-2006-07-31 (snap) PHP Bug Type: CGI related Bug description: Memlimit fatal error sent to "wrong" stderr when using fastcgi
Description: ------------ When using the FastCGI SAPI the error message when the memory limit is exceeded (Fatal error: Allowed memory size ... exhausted) is sometimes sent to the real stderr (the pipe) instead of the stderr within the FastCGI protocol (which the FastCGI client would handle). This only occurs in special circumstances. The code <?php $a = str_repeat("a", 100000000); ?> procudes an error regarding the memory limit too, but it is displayed correctly (on the "right" stderr, the FastCGI's one). Sending the same error to different targets sounds inconsistent to me. The problem didn't exist in PHP 5.1.4. Maybe it is related to http://bugs.php.net/bug.php?id=37481? Reproduce code: --------------- Request a file containing <?php for ($x=0;$x<8000000;$x++) $a[] = 'aaaaaa'; echo 'a'; ?> from a webserver which is configured to serve PHP files via FastCGI. Expected result: ---------------- The message Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 35 bytes) in /var/www/localhost/htdocs/a.php on line 1 should be served by the webserver (assuming display_errors=1 and error_reporting(E_ALL)) to the client. Additionally the data sent to the FastCGI socket seems to be corrupt (I didn't analyze it, but my own implementation had problems, and lighttpd seems to have canceled the request, my browser tried to download the PHP file (without content of course)). Actual result: -------------- On the console, the webserver (or FastCGI server) was started on, Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 35 bytes) in /var/www/localhost/htdocs/a.php on line 1 is displayed. -- Edit bug report at http://bugs.php.net/?id=38274&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38274&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38274&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38274&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38274&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38274&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38274&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38274&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38274&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38274&r=support Expected behavior: http://bugs.php.net/fix.php?id=38274&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38274&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38274&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38274&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38274&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38274&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38274&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38274&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38274&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38274&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38274&r=mysqlcfg