Edit report at https://bugs.php.net/bug.php?id=61272&edit=1

 ID:                 61272
 Comment by:         a dot vi at laposte dot net
 Reported by:        peacech at gmail dot com
 Summary:            ob_start callback get passed empty string
 Status:             Re-Opened
 Type:               Bug
 Package:            Output Control
 Operating System:   Arch 32 bit
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

Hi again,

I have used casper's patch. Compilation worked fine and it's all cool now. 
Thanks Casper

Regards


Previous Comments:
------------------------------------------------------------------------
[2012-08-21 11:17:32] a dot vi at laposte dot net

Same problem here with PHP5.4.6. I've had to patch my application and use:
ob_end_flush();
ob_clean();
instead of:
ob_end_clean();

I really agree with Casper: if this is not a change of behavior, this is a bug. 
My application was working really fine with PHP5.3.8 but was broken with 
PHP5.4.6. So something has changed 

Kind regards

------------------------------------------------------------------------
[2012-07-10 08:59:04] dragon829 at gmail dot com

We have the same problem in 5.4.4,and it hasn't reproduced in 5.3.14 .

------------------------------------------------------------------------
[2012-06-08 08:03:50] casper at langemeijer dot eu

Mike, I've dug a bit deeper into this problem, and must conclude that this 
really is a bug, or at least a change of behaviour.

I think test tests/output/ob_017.phpt is faulty too. I corrected bot output.c 
and the test in the patch I supplied.

In PHP 5.3 the callback function is called with the contents of the output 
buffer when ob_clean or ob_end_clean is called. The output will be fed to the 
callback function, but is erased right after that call.

After your output buffering rewrite the output buffer is cleaned before the 
callback is called.

I see no valid reason for a functional change. You're supplying the callback 
with a flag so that if needed the callback function could do this itself if 
needed.

------------------------------------------------------------------------
[2012-05-18 10:04:18] patrick at procurios dot nl

We are having the same problem and it keeps us from migrating to 5.4. Could you 
please fix it?

------------------------------------------------------------------------
[2012-03-05 14:43:25] peacech at gmail dot com

Unless ob_start callback specification has changed that for 
ob_clean/ob_end_clean, the output is discarded before calling the callback, 
then this is a bug. And I have scan the PHP 5.4 changelog and couldn't find 
anything mentioning this change.

So let me help by showing where the problem is

In line 1226 of output.c in the distributed PHP 5.4.0 source,

if (flags & PHP_OUTPUT_POP_DISCARD) {
    context.op |= PHP_OUTPUT_HANDLER_CLEAN;
    orphan->buffer.used = 0;
}
php_output_handler_op(orphan, &context);

orphan->buffer.used should not be set to 0 before calling the callback, 
otherwise the callback will be called with empty buffer.

And likewise in line 300 in php_output_clean

So, no, it isn't about appending $output to $buffer.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=61272


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

Reply via email to