php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40429 headers sent when using php://output + ob_start
Submitted: 2007-02-10 12:34 UTC Modified: 2007-03-21 14:17 UTC
From: nicolas dot grekas+php at gmail dot com Assigned:
Status: Closed Package: Streams related
PHP Version: 5.1.2 OS: WIN
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nicolas dot grekas+php at gmail dot com
New email:
PHP Version: OS:

 

 [2007-02-10 12:34 UTC] nicolas dot grekas+php at gmail dot com
Description:
------------
Opening the php://output stream seams to flag the headers as sent, event if output buffering is on. Consequently, any call to header() fails where it shouldn't.

Affects any extension that uses streams.


Reproduce code:
---------------
<?php

ob_start();
$h = fopen('php://output', 'wb');
fclose($h);
ob_end_clean();

header('X-Foo: bar');

?>

Or

<?php

ob_start();
$dom = new DOMDocument;
$dom->save('php://output');
ob_end_clean();

header('X-Foo: bar');

?>

Expected result:
----------------
blank page

Actual result:
--------------
Warning: Cannot modify header information - headers already sent in C:\[...]\test.php on line 8

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-11 09:37 UTC] tony2001@php.net
Cannot reproduce with any of your examples.
Makes sure you're actually using 5.2.1 and not something old.
 [2007-02-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-03-21 14:17 UTC] nicolas dot grekas+php at gmail dot com
Sorry, I was experimenting the bug in PHP 5.1.2, not 5.2.1...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC