One last note on this :

the limitation I'm talking about is annoying in two cases for me :
- I can't use "print_r($var, true)" inside an ob_handler, because print_r uses 
ob_start internally. And I need this to append some debug info to my buffer. The 
workaround for this is to make my own print_r...
 
- In some cases, I would like to send an email from an ob_handler. But I make my 
emails with some logic/presentation separation. And most if not all template systems 
use ob_start to fetch their output into a $variable. The workaround here is to 
register_shutdown_function the mail-sending function inside the ob_handler.
 
As you can see, I've two real problems, and a real solution (by PHP source mods) could 
be far better than two workarounds isn't it ? 
 
 
One would allow ob_start to be called inside an ob_handler, and the error message 
would be printed only if output buffering is always on at the end of this ob_handler, 
it would be perfect !
 
Please consider this idea, and thank you for your patience.
 
Nikos
 
 

Taco van den Broek <[EMAIL PROTECTED]> wrote: 

Okin okin wrote:
> I'm having trouble with output buffering limitation
> and the output_callback function of ob_start.
> 
> look at this script :
> 
> function ob_perso_handler($buffer)
> {
> ob_start();
> echo 'foo';
> $buffer .= ob_get_contents();
> ob_end_clean();
> 
> return $buffer;
> }
> 
> ob_start('ob_perso_handler');
> 
> echo 'Hello World !';
> 
> ?>
> 
> it outputs : "Fatal error: ob_start(): Cannot use
> output buffering in output buffering display handlers"
> 


I don't really understand your problem, it seams to me you want to add 
output to the buffer in the output handler!?

Why not just:

<?php
function myObHandler($buffer)
{
$buffer .= 'foo';
return $buffer;
}
ob_start('myObHandler');
?>

                
---------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !

Reply via email to