php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9212 fpassthru ignoring output buffering
Submitted: 2001-02-11 11:06 UTC Modified: 2006-10-27 01:14 UTC
From: ctuffli at yahoo dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4 OS: Linux 2.2.12-20
Private report: No CVE-ID: None
 [2001-02-11 11:06 UTC] ctuffli at yahoo dot com
When fpassthru() is used within an ob_start / ob_end_clean block, a subsequent call to header() fails because headers have already been sent. The following script reproduces the problem:

<?php
    $fd = fopen(__FILE__, "r");
    ob_start();
    fpassthru($fd);
    ob_end_clean();
    header("X-Test: fpassthru already sent headers");
?>

Ran as cgi (ie 'php head.php'), but the apache module exhibits the same problem. This problem may be similar to bug #8807

./configure --with-apxs=/usr/local/etc/httpd/bin/apxs --enable-versioning --with-mysql --enable-track-vars

no php.ini is used

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-11 11:17 UTC] derick@php.net
passtru doesn't use the output buffering functions. It's not meant to be, so changing to Feature request.
 [2001-02-11 13:39 UTC] ctuffli at yahoo dot com
Actually, fpassthru seems to partial support the output buffering as placing it between ob_start / ob_end_clean generates no output. ob_get_contents() placed after the fpassthru correctly returns the output fpassthru would have generated. My concern here was that fpassthru seems to be generating a header (headers_sent() returns true) even though the rest of the output is being correctly buffered. Is the buffering happening by a happy accident?

Is there a list of functions that work (or don't work) with output buffering?
 [2002-11-28 06:04 UTC] wez@php.net
Seems to use buffers now (in 4.3).
I'm not sure if this is the case in 4.2, or even if we
want this behaviour.
Derick?
 [2006-10-27 01:14 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 07:01:32 2024 UTC