Doc #71486 [Opn->Csd]: Output handler flags for ob_end_clean and ob_end_flush
| From: | girgias@php.net | Date: | Sun, 07 Jan 2024 14:03:39 +0000 |
| Subject: | Doc #71486 [Opn->Csd]: 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-19689@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: girgias@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
+Status: Closed
Type: Documentation Problem
Package: Output Control
PHP Version: 5.6.17
-Assigned To:
+Assigned To: girgias
Block user comment: N
Private report: N
New Comment:
Closed by https://github.com/php/doc-en/pull/3073
Previous Comments:
------------------------------------------------------------------------
[2016-03-09 15:33:05] mike@php.net
Related To: Bug #69404
------------------------------------------------------------------------
[2016-03-09 15:32:27] mike@php.net
See also #69404
------------------------------------------------------------------------
[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