|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66758 Flags and control output buffering functions
Submitted: 2014-02-23 22:43 UTC Modified: 2014-07-16 01:35 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: krzysiekpiasecki at yahoo dot com Assigned: yohgaki (profile)
Status: Closed Package: Output Control
PHP Version: 5.5.8 OS: MAC OS X 10.8.5
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: krzysiekpiasecki at yahoo dot com
New email:
PHP Version: OS:


 [2014-02-23 22:43 UTC] krzysiekpiasecki at yahoo dot com
From PHP manual: PHP_OUTPUT_HANDLER_CLEANABLE const control access to functions: ob_clean(), ob_end_clean(), and ob_get_clean().

Using ob_end_clean(), there is a notice: "ob_end_clean(): failed to discard buffer of default output handler (1)".

Using ob_get_clean(), there is even a double notice: "ob_get_clean(): failed to delete buffer of default output handler (1)".

I understand, that only cleanable buffer can't be flush and delete. So why in manual these functions are under control PHP_OUTPUT_HANDLER_CLEANABLE const? I'm confused.

Test script:
ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);    
ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);    

Expected result:
No notice, and no buffer after function invocation.

Actual result:
ob_end_clean() produces notice:
Notice: ob_end_clean(): failed to discard buffer of default output handler (1) 

ob_get_clean() produces double notice:
Notice: ob_get_clean(): failed to discard buffer of default output handler (2)
Notice: ob_get_clean(): failed to discard buffer of default output handler (2)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-23 22:46 UTC] krzysiekpiasecki at yahoo dot com
-PHP Version: Irrelevant +PHP Version: 5.5.8
 [2014-02-23 22:46 UTC] krzysiekpiasecki at yahoo dot com
Version is 5.5.8
 [2014-07-07 05:26 UTC]
-Type: Documentation Problem +Type: Bug -Assigned To: +Assigned To: mike
 [2014-07-07 05:26 UTC]
Verified on my Fedora 20 with PHP 5.5.14.
This seems a bug rather than doc issue. What do you think, mike?

echo 'AAA';

This code does not clean buffer, raises error, then outputs 'AAA'.
 [2014-07-07 07:47 UTC]
-Status: Assigned +Status: Not a bug
 [2014-07-07 07:47 UTC]
Control is more fine grained now; you need to add PHP_OUTPUT_HANDLER_REMOVABLE to be able to pop it off the stack:


Or if flushing is also allowed (good idea), you can use PHP_OUTPUT_HANDLER_STDFLAGS, which includes all three capabilities.
 [2014-07-07 07:50 UTC]
-Status: Not a bug +Status: Re-Opened -Type: Bug +Type: Documentation Problem
 [2014-07-07 07:50 UTC]
Silly me. Re-opening as a doc issue.

JFYI the behavior is that way since PHP-5.4.0
 [2014-07-15 18:22 UTC]
-Assigned To: mike +Assigned To: yohgaki
 [2014-07-15 18:22 UTC]
Forgot to assign back :P
 [2014-07-15 23:07 UTC]
No problem for documenting.


I thought it would be nicer if ob_end_clean() raises error for removing and clean output, but documentation should be ok.
 [2014-07-16 01:35 UTC]
Automatic comment from SVN on behalf of yohgaki
Log: Fixed bug #66758
 [2014-07-16 01:35 UTC]
-Status: Re-Opened +Status: Closed
 [2020-02-07 06:08 UTC]
Automatic comment on behalf of yohgaki
Log: Fixed bug #66758
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Mar 23 09:03:38 2023 UTC