-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed as not planned
Description
Description
When you check if PHP_OUTPUT_HANDLER_DISABLED
is set with var_dump( ob_get_status( true ) );
you see it's set. The ob callback is still called every time, however with an empty string.
If the output buffer is disabled, the callback shouldn't be called at all.
The following code:
<?php
function my_cb( $a ) {
return 'AAA' . PHP_EOL . $a . 'BBB' . PHP_EOL;
}
function my_cb2( $a ) {
if ( $a === 'XXX' ) {
return false;
}
if ( $a === '' ) {
$a = 'EMPTY';
}
return 'CCC' . PHP_EOL . $a . 'DDD' . PHP_EOL;
}
ob_start( 'my_cb', 0 );
ob_start( 'my_cb2', 0 );
echo "XXX";
ob_flush();
#var_dump( ob_get_status( true ) );
echo "ONE" . PHP_EOL;
ob_flush();
echo "TWO" . PHP_EOL;
ob_flush();
Resulted in this output:
AAA
XXXONE
CCC
EMPTYDDD
TWO
CCC
EMPTYDDD
BBB
But I expected this output instead:
AAA
XXXONE
TWO
BBB
PHP Version
PHP 8.3.x
Operating System
No response