Doc #65826 [Opn->Csd]: ob_list_handlers: outdated return values & examples
| From: | girgias@php.net | Date: | Sun, 07 Jan 2024 13:45:46 +0000 |
| Subject: | Doc #65826 [Opn->Csd]: ob_list_handlers: outdated return values & examples | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-19686@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65826&edit=1
ID: 65826
Updated by: girgias@php.net
Reported by: ca2 at lapage dot com
Summary: ob_list_handlers: outdated return values & examples
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Output Control
-Operating System: win32
+Operating System:
PHP Version: 5.5.4
-Assigned To:
+Assigned To: girgias
Block user comment: N
Private report: N
New Comment:
Fixed via: https://github.com/php/doc-en/pull/3042
Previous Comments:
------------------------------------------------------------------------
[2013-10-03 16:13:25] ca at lapage dot com
Related To: Bug #62019
------------------------------------------------------------------------
[2013-10-03 16:12:34] ca2 at lapage dot com
Related Doc Bug #62019 for ob_get_status()
------------------------------------------------------------------------
[2013-10-03 12:59:26] ca at lapage dot com
The Examples should also be changed the script and result I provided in the report. (Without the
version report and command lines.)
------------------------------------------------------------------------
[2013-10-03 12:53:34] ca2 at lapage dot com
Description:
------------
---
From manual page: http://www.php.net/function.ob-list-handlers#refsect1-function.ob-list-handlers-returnvalues
---
The "Return Values" section says:
###
This will return an array with the output handlers in use (if any). If output_buffering is enabled
or an anonymous function was used with ob_start(), ob_list_handlers() will return "default
output handler".
###
It should say:
###
This will return an array with the output handlers in use (if any).
* If output_buffering is enabled, or ob_start was used without an output_callback, the handler is
"default output handler".
* If the output_callback was an anonymous function specified by create_function(), the handler is an
empty string. (In PHP 5.4 and below it is "default output handler".)
* If the output_callback was an anonymous function specified as a closure, the handler is
"Closure::__invoke".
###
I tested on Win8x86 with PHP 5.5.4.
I tested on Linux with PHP 5.4.20 and PHP 5.3.27.
Test script:
---------------
if (ini_get('output_buffering')) {
print "using output_buffering=on\n";
print_r(ob_list_handlers());
ob_end_flush();
} else {
ob_start("ob_gzhandler");
print "ob_gzhandler\n";
print_r(ob_list_handlers());
ob_end_flush();
ob_start(create_function('$string', 'return $string;'));
print "anonymous function / create function\n";
print_r(ob_list_handlers());
ob_end_flush();
ob_start(function($string) { return $string; });
print "anonymous function / closure\n";
print_r(ob_list_handlers());
ob_end_flush();
}
Expected result:
----------------
[output if the doc was right]
# php --version
PHP 5.5.4 (cli) (built: Sep 18 2013 13:04:23)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
# php -d output_buffering=on test.php
using output_buffering=on
Array
(
[0] => default output handler
)
# php -d test.php
ob_gzhandler
Array
(
[0] => ob_gzhandler
)
anonymous function / create function
Array
(
[0] => default output handler
)
anonymous function / closure
Array
(
[0] => default output handler
)
Actual result:
--------------
[correct output]
# php --version
PHP 5.5.4 (cli) (built: Sep 18 2013 13:04:23)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
# php -d output_buffering=on test.php
using output_buffering=on
Array
(
[0] => default output handler
)
# php -d test.php
ob_gzhandler
Array
(
[0] => ob_gzhandler
)
anonymous function / create function
Array
(
[0] =>
)
anonymous function / closure
Array
(
[0] => Closure::__invoke
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65826&edit=1