Doc #65826 [Opn->Csd]: ob_list_handlers: outdated return values & examples
[email protected] Sun, 07 Jan 2024 13:45:46 +0000
| Newsgroups | php.doc.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=65826&edit=1 ID: 65826 Updated by: [email protected] 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