php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49689 ob_start() does not capture output to STDOUT
Submitted: 2009-09-27 18:55 UTC Modified: 2009-09-27 20:38 UTC
From: chammers at netcologne dot de Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chammers at netcologne dot de
New email:
PHP Version: OS:

 

 [2009-09-27 18:55 UTC] chammers at netcologne dot de
Description:
------------
Output buffering does capture the output of print() and echo() but apparently not anything that goes to STDOUT (php://stdout) via fwrite().

That should preferably be fixed or at least be documented.

Reproduce code:
---------------
$ cat t.php
<?php
error_reporting(E_ALL);

ob_start();

echo "does work\n";

$f = fopen('php://stdout', 'w');
fwrite($f, "does not work\n");
fclose($f);

$v = ob_get_contents();
ob_end_clean();

print("CAPTURED: $v\n");


Expected result:
----------------
$ php t.php

CAPTURED: does not work
does work

Actual result:
--------------
$ php t.php
does not work
CAPTURED: does work


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-27 20:38 UTC] felipe@php.net
See #49688
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 10:01:32 2025 UTC