php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71486 Output handler flags for ob_end_clean and ob_end_flush
Submitted: 2016-01-30 15:56 UTC Modified: 2024-01-07 14:03 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: php at login dot hedim dot ch Assigned: girgias (profile)
Status: Closed Package: Output Control
PHP Version: 5.6.17 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at login dot hedim dot ch
New email:
PHP Version: OS:

 

 [2016-01-30 15:56 UTC] 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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-09 15:28 UTC] mike@php.net
-Type: Bug +Type: Documentation Problem
 [2016-03-09 15:28 UTC] 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-03-09 15:32 UTC] mike@php.net
See also #69404
 [2024-01-07 14:03 UTC] girgias@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: girgias
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC