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 this is not your bug, you can add a comment by following this link.
If this is your bug, but 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

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: Mon Apr 29 16:01:31 2024 UTC