|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-02-11 07:56 UTC] clover at fromru dot com
Description:
------------
i'm using ob_start() with a callback function; internally in it i use $res=var_export($var, TRUE) function but got an error:
[11-Feb-2005 08:28:15] PHP Fatal error: var_export() [<a href='ref.outcontrol'>ref.outcontrol</a>]: Cannot use output buffering in output buffering display handlers in E:\htdocs\index.php on line XXX
Reproduce code:
---------------
<?php
ob_start("my_shutdown_function");
function my_shutdown_function($buffer){
$var=headers_list();
$res=var_export($var, TRUE);
return($res);
}
print("something...");
?>
Expected result:
----------------
the "dump" of all sent headers instead of string "something..."
Actual result:
--------------
"PHP Fatal error..."
Comment: this error actually must be when i call var_dump() or var_export($var, FALSE) in output buffering handler.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 23:00:02 2025 UTC |
Try this instead: <?php ob_start('foo');function foo ($buffer) { return var_export($buffer,true); } echo "bar!"; ?> It does exactly same thing in PHP 4.3.x and PHP 5.x.x so Jakub is right here..