#40429 [Opn->Fbk]: headers sent when using php://output + ob_start

From: Date: Sun, 11 Feb 2007 09:37:08 +0000
Subject: #40429 [Opn->Fbk]: headers sent when using php://output + ob_start
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-108693@lists.php.net to get a copy of this message
ID: 40429 Updated by: tony2001@php.net Reported By: nicolas dot grekas+php at gmail dot com -Status: Open +Status: Feedback Bug Type: Streams related Operating System: WIN PHP Version: 5.2.1 New Comment: Cannot reproduce with any of your examples. Makes sure you're actually using 5.2.1 and not something old. Previous Comments: ------------------------------------------------------------------------ [2007-02-10 12:34:13] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40429&edit=1

« previous php.bugs (#108693) next »