Bug #66758 [Asn->Nab]: Flags and control output buffering functions
| From: | mike@php.net | Date: | Mon, 07 Jul 2014 07:47:58 +0000 |
| Subject: | Bug #66758 [Asn->Nab]: Flags and control output buffering functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186496@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66758&edit=1
ID: 66758
Updated by: mike@php.net
Reported by: krzysiekpiasecki at yahoo dot com
Summary: Flags and control output buffering functions
-Status: Assigned
+Status: Not a bug
Type: Bug
Package: Output Control
Operating System: MAC OS X 10.8.5
PHP Version: 5.5.8
Assigned To: mike
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2014-07-07 05:26:43] 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-02-23 22:46:36] krzysiekpiasecki at yahoo dot com
Version is 5.5.8
------------------------------------------------------------------------
[2014-02-23 22:43:42] 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)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66758&edit=1