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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

History

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