|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38274 Memlimit fatal error sent to "wrong" stderr when using fastcgi
Submitted: 2006-07-31 20:13 UTC Modified: 2006-12-04 16:21 UTC
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: ch at hoffie dot info Assigned: dmitry (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 5.2.0 OS: Linux
Private report: No CVE-ID: None
 [2006-07-31 20:13 UTC] ch at hoffie dot info
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 

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-01 12:49 UTC] ch at hoffie dot info
It's still reproducable with 5.2.0RC3. It's annoying to see empty pages instead of error messages in development (where you may expect error messages to be served by the webserver).

Was my description not clear enough?
 [2006-10-08 10:22 UTC] ch at hoffie dot info
Still reproducable with rc5... Seems it isn't going to be fixed until the final will be released...
 [2006-11-03 13:26 UTC] ch at hoffie dot info
And the final contains this bug as well...
 [2006-12-04 16:20 UTC]
Fixed in CVS HEAD and PHP_5_2.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jun 02 08:03:37 2023 UTC