Re: output buffering callback limitation
| From: | Andre Cerqueira | Date: | Thu, 10 Jun 2004 08:03:45 +0000 |
| Subject: | Re: output buffering callback limitation | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10370@lists.php.net to get a copy of this message | ||
maybe php.general would be more appropriate
im not a developer, but i think this "feature" doesnt make sense hehe
i think ob display handlers are not supposed to output things directly, they just return them to the function that will output it
at your first snip, you could/should do:
<?php
function ob_perso_handler($buffer)
{
$buffer = 'foo'. $buffer; //you already received output data
return $buffer;
}
ob_start('ob_perso_handler');
echo 'Hello World !';
?>
at the second:
<?php
function ob_perso_handler1($buffer)
{
return $buffer .'f1';
}
function ob_perso_handler2($buffer)
{
return 'foo'. $buffer .'f2';
}
ob_start('ob_perso_handler1');
ob_start('ob_perso_handler2');
echo 'Hello World !';
?>
good luck on the killer appz
Okin okin wrote:
Hi, I'm having trouble with output buffering limitation and the output_callback function of ob_start. look at this script : <?php 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" Why then ? It would be a killer feature for my next killer appz ! I've tried also : <?php function ob_perso_handler1($buffer) { return $buffer . 'f1'; } function ob_perso_handler2($buffer) { ?> foo <? return $buffer . 'f2'; } ob_start('ob_perso_handler1'); ob_start('ob_perso_handler2'); echo 'Hello World !'; ?> but were does "foo" go ? any idea on that ? maybe some source change to PHP to permit one or the other solution ? I'm new to this mailing list, please redirect me to the correct one if I'm wrong here. My thought was it was a developper problem, since change to the source has to be done to enable such this feature ... Many thank's for any help ! Nikos Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc