php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27224 var_dump() cannot be stopped from output
Submitted: 2004-02-11 15:50 UTC Modified: 2004-02-12 09:38 UTC
From: reklov at unitedklasens dot de Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.4 OS: Win98SE
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: reklov at unitedklasens dot de
New email:
PHP Version: OS:

 

 [2004-02-11 15:50 UTC] reklov at unitedklasens dot de
Description:
------------
On the contrary to the tip in the documentation (http://www.php.net/manual/en/function.var-dump.php), there's no chance to stop var_dump() from outputting. Although you can save it with output buffering into a string, it will be sent to output, anyway...
As you can see in the example, the var_dump()-output is sent to output twice, first from var_dump(9), second from echo $output.

Reproduce code:
---------------
<pre>
<?php
$a = 'Output';
echo 'Output from var_dump():'."\n";
ob_start();
var_dump($a);
$output = ob_get_flush();
echo 'Same as above: '."\n".$output;
?>
</pre>

Expected result:
----------------
<pre>
Output from var_dump():

Same as above: 
string(6) "Output"
</pre>

Actual result:
--------------
<pre>
Output from var_dump():
string(6) "Output"
Same as above: 
string(6) "Output"
</pre>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-11 15:52 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

from manual (http://nl3.php.net/ob_flush): 

ob_flush --  Flush (send) the output buffer 



see also:
http://nl3.php.net/manual/en/function.ob-get-clean.php

 [2004-02-12 09:38 UTC] reklov at unitedklasens dot de
Ok, thx...it seems, it was a missunderstanding while reading the manual (http://reklov.homeip.net/manual/PHP/function.ob-get-flush.html):
ob_get_flush --  Flush the output buffer, return it as a string and turn off output buffering 

<--- i understood it this way: flush the output into a string an turn off...
instead of flush (understood as delete) the output, send it and return to a string and turn off...
perhaps this happened, because of my not very well english (i guess, you have already noticed that...)

Thx for the answer
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 06:01:34 2025 UTC