php.net |  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
Votes:1
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: krzysiekpiasecki at yahoo dot com
New email:
PHP Version: OS:

 

 [2014-02-23 22:43 UTC] krzysiekpiasecki at yahoo dot com
Description:
------------
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_end_clean();
    
ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);    
ob_get_clean();



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)


Patches

Pull Requests

History

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] yohgaki@php.net
-Type: Documentation Problem +Type: Bug -Assigned To: +Assigned To: mike
 [2014-07-07 05:26 UTC] yohgaki@php.net
Verified on my Fedora 20 with PHP 5.5.14.
This seems a bug rather than doc issue. What do you think, mike?

ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);
echo 'AAA';
ob_end_clean();

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

ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_REMOVABLE);

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] mike@php.net
-Status: Not a bug +Status: Re-Opened -Type: Bug +Type: Documentation Problem
 [2014-07-07 07:50 UTC] mike@php.net
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] mike@php.net
-Assigned To: mike +Assigned To: yohgaki
 [2014-07-15 18:22 UTC] mike@php.net
Forgot to assign back :P
 [2014-07-15 23:07 UTC] yohgaki@php.net
No problem for documenting.

ob_start(null, 0, PHP_OUTPUT_HANDLER_CLEANABLE);

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] yohgaki@php.net
Automatic comment from SVN on behalf of yohgaki
Revision: http://svn.php.net/viewvc/?view=revision&revision=334288
Log: Fixed bug #66758
 [2014-07-16 01:35 UTC] yohgaki@php.net
-Status: Re-Opened +Status: Closed
 [2020-02-07 06:08 UTC] phpdocbot@php.net
Automatic comment on behalf of yohgaki
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=8ade7e698aaedd1684b310373c4088b9bdebf912
Log: Fixed bug #66758
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 13:01:27 2024 UTC