|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #74399 ob_*clean* methods do not respect missing cleanable flag; same for flushing
Submitted: 2017-04-10 06:02 UTC Modified: 2024-01-07 14:04 UTC
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: krody dot robi at gmail dot com Assigned: girgias (profile)
Status: Closed Package: Output Control
PHP Version: 7.1.3 OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: krody dot robi at gmail dot com
New email:
PHP Version: OS:


 [2017-04-10 06:02 UTC] krody dot robi at gmail dot com
This is happening in both php 5.6.29 and php 7.1.0 haven't checked any other versions -> that is why I marked it as version irrelevant as it seems to be version independent

Test script:
function callback($buffer, $status) {
    return "callback $buffer";


echo 'test';

echo ob_get_clean();         //this should not work as no CLEANABLE flag was set on ob_start
                             //ob_end_clean is ran as well
                             //ob_clean -> failed to delete buffer notice

echo "\n".ob_get_level();

Expected result:
PHP Notice on ob_start not having the correct flags set for action for the following methods


Actual result:
ob_get_clean() - retrieves buffer content, destroys the buffer
ob_end_clean() - buffer destroyed


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-10 08:05 UTC]
-Summary: ob_*clean* methods do not respect missing cleanable flag +Summary: ob_*clean* methods do not respect missing cleanable flag; same for flushing -Status: Open +Status: Verified -PHP Version: Irrelevant +PHP Version: 7.1.3
 [2017-04-10 08:05 UTC]
Goes back to when the flags were introduced in 5.4:

Indeed, CLEANABLE only affects ob_clean() and FLUSHABLE only affects ob_flush(). Looks like it would be fairly straightforward to add in.

The alternative would be adjusting the docs, but having those functions respect the flags makes sense to me. And in the case of ob_end_clean and ob_end_flush I would expect both the cleanable/flushable and the removable flags to be required.
 [2017-04-28 07:43 UTC]
-Status: Verified +Status: Not a bug
 [2017-04-28 07:43 UTC]
Unfortunately there's no one-to-one correlation between the legacy userland function names and the flags of the new output API.

- ob_end_flush() is actually a finalize & send and not a "flush" in a strict sense
- ob_get_flush() is a finalize & send action, too
- ob_end_clean() is actually a discard & remove and not a "clean" in a strict sense
- ob_get_clean() is a finalize & remove action

I know, the legacy function names are bad and confusing, but were kept for BC, as was their functionality.
 [2017-04-28 07:48 UTC]
See also bug #69404
 [2017-04-28 07:50 UTC]
-Status: Not a bug +Status: Verified -Type: Bug +Type: Documentation Problem
 [2017-04-28 07:50 UTC]
Then this is a doc bug because all four functions claim they need the respective CLEANABLE/FLUSHABLE flag to work.
 [2024-01-07 14:04 UTC]
-Status: Verified +Status: Closed -Assigned To: +Assigned To: girgias
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 13:01:29 2024 UTC