Doc #71486 [Opn]: Output handler flags for ob_end_clean and ob_end_flush
| From: | mike@php.net | Date: | Wed, 09 Mar 2016 15:32:29 +0000 |
| Subject: | Doc #71486 [Opn]: Output handler flags for ob_end_clean and ob_end_flush | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13249@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71486&edit=1
ID: 71486
Updated by: mike@php.net
Reported by: php at login dot hedim dot ch
Summary: Output handler flags for ob_end_clean and
ob_end_flush
Status: Open
Type: Documentation Problem
Package: Output Control
PHP Version: 5.6.17
Block user comment: N
Private report: N
New Comment:
See also #69404
Previous Comments:
------------------------------------------------------------------------
[2016-03-09 15:28:02] mike@php.net
Actually, PHP_OUTPUT_HANDLER_CLEANABLE is only needed for
ob_clean() because
that's the only operation, that would leave the output handler alive instead of destroying and
popping it off the stack.
------------------------------------------------------------------------
[2016-01-30 15:56:54] php at login dot hedim dot ch
Description:
------------
According to http://php.net/manual/en/function.ob-end-clean.php:
The output buffer must be started by ob_start() with PHP_OUTPUT_HANDLER_CLEANABLE and
PHP_OUTPUT_HANDLER_REMOVABLE flags. Otherwise ob_end_clean() will not work.
However, ob_end_clean() seems to work with only PHP_OUTPUT_HANDLER_REMOVABLE.
According to http://php.net/manual/en/function.ob-end-flush.php:
The output buffer must be started by ob_start() with PHP_OUTPUT_HANDLER_FLUSHABLE and
PHP_OUTPUT_HANDLER_REMOVABLE flags. Otherwise ob_end_flush() will not work.
However, ob_end_flush() seems to work with only PHP_OUTPUT_HANDLER_REMOVABLE.
The test script below shows the problem with ob_end_clean(). To see the problem with ob_end_flush(),
simply replace ob_end_clean() with ob_end_flush().
Test script:
---------------
ob_start(null, 0, PHP_OUTPUT_HANDLER_REMOVABLE);
echo "1";
ob_end_clean();
echo "2";
Expected result:
----------------
A notice from ob_end_clean() and output "12"
Actual result:
--------------
Output "2"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71486&edit=1