ID:               33974
 User updated by:  php at koterov dot ru
 Reported By:      php at koterov dot ru
 Status:           Bogus
 Bug Type:         Output Control
 Operating System: any
 PHP Version:      4.3.11
 New Comment:

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?


Previous Comments:
------------------------------------------------------------------------

[2005-08-04 13:49:15] php at koterov dot ru

Very strange, because object-based callbacks works fine with
ob_start(). So I guess that full callback info is stored somewhere.

OK, debug purpose. But - maybe write it explicitly in documentation?
"This function is for debug purposes only. Do not try to use it for
manual callback execution - references will be wrong for object-based
callbacks."

------------------------------------------------------------------------

[2005-08-03 15:46:05] [EMAIL PROTECTED]

This is how the engine stores callbacks names.
ob_list_handlers() has nothing to do with it. 
This functions is for debugging purposes only and there is nothing said
in the docs that it should return valid callbacks.

------------------------------------------------------------------------

[2005-08-03 15:35:21] php at koterov dot ru

There is nothing said about this behaviour in the documentation:

http://www.php.net/manual/ru/function.ob-list-handlers.php

And - if I cannot trust the result of ob_list_handlers() (I cannot - it
returns bogus handler names), is this function necessary at all?

------------------------------------------------------------------------

[2005-08-03 13:22:51] [EMAIL PROTECTED]

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



------------------------------------------------------------------------

[2005-08-03 12:35:45] 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" }


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33974&edit=1

Reply via email to