Doc #65826 [NEW]: ob_list_handlers: outdated return values & examples
| From: | ca2 at lapage dot com | Date: | Thu, 03 Oct 2013 12:53:34 +0000 |
| Subject: | Doc #65826 [NEW]: ob_list_handlers: outdated return values & examples | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-10396@lists.php.net to get a copy of this message | ||
From: ca2 at lapage dot com
Operating system: win32
PHP version: 5.5.4
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:ob_list_handlers: outdated return values & examples
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 bug report at https://bugs.php.net/bug.php?id=65826&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65826&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65826&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65826&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65826&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65826&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65826&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65826&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65826&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65826&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65826&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=65826&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=65826&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65826&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65826&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65826&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65826&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65826&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65826&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65826&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65826&r=mysqlcfg