php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20772 fpassthru() loads entire file in RAM
Submitted: 2002-12-02 16:43 UTC Modified: 2002-12-05 12:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: busia at tiscali dot it Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.0RC2 OS: redhat 7.0
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: busia at tiscali dot it
New email:
PHP Version: OS:

 

 [2002-12-02 16:43 UTC] busia at tiscali dot it
If I try to run this script the server simply exit without giving me anything.

<?
echo "A";
$fd=fopen("aaa/temp", "wb");
fpassthru($fd);
echo "B";
}
?>

The server is configured with output buffering activated (gz_handler), memory limit enabled (8MB) and the temp file is bigger than 8MByte

I have understand that the problem that the script excedeed the memory limit and adding, as first line,

ob_end_clean();

the script works, but in the error log there isn't a fatal error or a warning, nothing; also the access log doesn't log the hit. It's possible to add a fatal error to let the programmer know what is the problem.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-02 16:50 UTC] busia at tiscalinet dot it
In the script the last "}" is to delete.
 [2002-12-03 06:41 UTC] busia at tiscalinet dot it
Errata corridge:

The script works well adding the "ob_end_clean()" function only if I use php 4.2.3.

Using php 4.3.0RC2 the script give me a blank document.

I have tried to set
-----------------------
php_flag output_buffering Off
-----------------------
in .htaccess and to comment the "ob_and_clean()" but the script give me a "unable to find the server" error now (this is also the error that the script gave me with output buffering activated and no "ob_end_clean" in php 4.2.3)

Summary:

php 4.3.0RC2 + output buffering on (without "ob_end_clean()"): "unable to find the server" error.

php 4.3.0RC2 + output buffering on (with "ob_end_clean()"): "document contains no data" error.

php 4.2.3 + output buffering on (without "ob_end_clean()"): "unable to find the server" error.

php 4.2.3 + output buffering on (with "ob_end_clean()"): all is ok.

I have experienced the same "document contains no data" in other scripts in which i used the "ob_end_clean()" function to deactivate the output buffering (when I cannot use .htaccess) but these scripts worked well with php 4.2.3.

Andrea Busia
 [2002-12-03 06:43 UTC] busia at tiscalinet dot it
to add to the summary:

php 4.3.0RC2 without output buffering : "unable to
find the server" error.
 [2002-12-03 12:26 UTC] busia at tiscalinet dot it
Using php4.3.0RC2:
Now I have put a .htaccess file with
------------------
php_flag output_buffering Off
------------------
and added
ini_set('memory_limit','100M');
at the beginning of the script

and now it works but the script is using 40Mbyte RAM, why?
The
fpassthru($fd)
function seems to load the complete file in memory but in version 4.2.3 it sent it directly to the output without loading it in memory.
 [2002-12-03 15:38 UTC] busia at tiscali dot it
Because the problem seems to be a "fpassthru" problem, I have changed the category from "output control" to "filesystem function"
 [2002-12-03 16:40 UTC] busia at tiscali dot it
I have changed this bug report to analyze simply the "fpassthru()" bug and I have opened to other bug reports regarding ob_end_clean and memory limit problems.

These seem to be independent bugs.
 [2002-12-04 18:15 UTC] iliaa@php.net
The lack of the memory limit error message is directly related to bug #20802.
 [2002-12-05 12:02 UTC] busia at tiscali dot it
I know that "the lack of the memory limit error message is directly related to bug #20802", I reported bug #20802! ;)

I'm interested to know and the correct the fpassthru problem with this bug report.
 [2002-12-05 12:11 UTC] busia at tiscali dot it
The bug didn't concern fpassthru, I have seen this is an output control bug and I have posted a new bug submission.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 10:01:31 2024 UTC