Doc #49688 [Com]: ob_start() does not capture output to STDOUT
| From: | nicolas dot vanheu at gmail dot com | Date: | Wed, 25 Jul 2012 14:03:49 +0000 |
| Subject: | Doc #49688 [Com]: ob_start() does not capture output to STDOUT | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8639@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=49688&edit=1
ID: 49688
Comment by: nicolas dot vanheu at gmail dot com
Reported by: ch at lathspell dot de
Summary: ob_start() does not capture output to STDOUT
Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Linux
PHP Version: 5.3.0
Block user comment: N
Private report: N
New Comment:
You might want to use php://output instead of php://stdout if your intention is
to write to the output buffer.
Previous Comments:
------------------------------------------------------------------------
[2009-11-13 21:47:34] svn@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=290707
Log: php://stdout doesn't use output buffer (bug #49688)
------------------------------------------------------------------------
[2009-11-13 21:47:29] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
------------------------------------------------------------------------
[2009-09-27 21:39:46] jani@php.net
Using php://stdout means you're by-passing output buffering
intentionally. Perhaps a note or two could be in order in the docs..
------------------------------------------------------------------------
[2009-09-27 18:54:52] ch at lathspell 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=49688&edit=1