| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2005-08-03 12:35 UTC] php at koterov dot ru
 Description:
------------
Seems ob_list_handlers() cannot return handlers represented as object with method names (see ob_start(array(&$obj, 'F'))). It returns them as "ClassName::MethodName", not as array(..., ...).
Reproduce code:
---------------
<?php
class C { function F($s) { return $s; } }
$obj = new C();
ob_start(array(&$obj, 'F'));
$list = ob_list_handlers();
var_dump($list);
?>
Expected result:
----------------
array(1) { [0]=>  array(..., 'F') }
// where "..." is object $obj
Actual result:
--------------
array(1) { [0]=>  string(4) "c::F" }
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 13:00:02 2025 UTC | 
I'll detalize why do I say all this words. It would be great to MANUALLY process all output buffers with their callbacks at the end of script - something like this: foreach (array_reverse(ob_list_handlers()) as $h) { $text = ob_get_contents(); ob_end_clean(); echo call_user_func($h, $text); } Why? Very simple: if I let the callbacks to be called automatically, I'll loose ALL errors, warnings and notices in them, because errors are suppress on standard OB callback execution. But, if I call all the callbacks manually (see example above), it's OK with errors. I use OB callbacks very often, an there are a lot of PHP code in them (e.g. - HTML tag parsing, placeholder substitutions etc.). Callbacks is a very powerful technique, but - almost undebuggable. Maybe extend ob_get_status(true) adding valid callback references to returned array?