php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32870 Setting "output_handler" does not work with custom functions
Submitted: 2005-04-28 17:56 UTC Modified: 2005-04-29 10:26 UTC
From: ng4rrjanbiah at rediffmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.4 OS: Windows XP
Private report: No CVE-ID: None
 [2005-04-28 17:56 UTC] ng4rrjanbiah at rediffmail dot com
Description:
------------
Setting output_handler (either through php.ini our .htaccess) does not work with custom functions. It works for "ob_gzhandler" but *not* on any custom functions--say "foo".

There was a detail discussion on c.l.php about this http://groups.google.com/groups?as_umsgid=1114004547.490393.294850@z14g2000cwz.googlegroups.com

Though we could set custom callback functions through ob_start(), we couldn't set output_handler (for custom functions) via php.ini. The manual also hints that it could be set PHP_INI_PERDIR basis http://in2.php.net/ref.outcontrol#AEN111555

Peace to you all PHP saints...

-R. Rajesh Jeba Anbiah

Reproduce code:
---------------
in php.ini set:
output_handler "foo_callback"

in test.php:
<?php
function foo_callback($buffer) //callback defined

{
   return $buffer;
}

print_r(ob_list_handlers());
?>

Expected result:
----------------
"foo_callback" to be listed

Actual result:
--------------
nothing. (Callback not registered.)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-29 01:36 UTC] sniper@php.net
It won't work because the script is compiled and executed AFTER the automatic output buffering using the php.ini output_handler is started. 

Docteam: It should be noted here http://www.php.net/manual/en/ref.outcontrol.php in the configuration directives paragraph, section "output_handler", 
that you can only use the buildin output handler functions
and not any user defined ones.



 [2005-04-29 10:26 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"Only built-in functions can be used with this directive. For user defined functions, use ob_start()."

Sniper, thanks for pointing on the right place for documenting.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 10:01:28 2024 UTC