[wp-hackers] Replace default doctype on one page only through plugin

Mike Schinkel mikeschinkel at newclarity.net
Mon Jan 19 08:39:53 GMT 2009

Gaarai <gaarai at gaarai.com> wrote:
> The problem is that the ob_start function does not nest. There is no 
> way to guarantee that nothing else will call ob_start between the
> start_output_collection() and send_output() functions. On a standard 
> install with the default theme, there are a total of 45 apply_filters 
> calls as well as requiring the theme's header.php code. At any point 
> in executing an of these sections of code, some code may exist that 
> makes use of ob_start.

I'm confused.  According to PHP.NET[1]:

   Output buffers are stackable, that is, you may call ob_start() 
   while another ob_start() is active. Just make sure that you call 
   ob_end_flush() the appropriate number of times. If multiple output 
   callback functions are active, output is being filtered sequentially 
   through each of them in nesting order. 

And this[2] explicitly says you can nest calls. Obviously, I'm missing something as your statement and PHP.NET seem to contradict. I'm sure it's my misunderstanding; I've been coding for 20 years but only PHP for two and only recently on a hard-core basis so I haven't learned all it's ins-and-outs of PHP. So I'm hoping you can help me better understand this apparent dichotomy. 


-Mike Schinkel

[1] http://us3.php.net/ob_start
[2] http://www.codewalkers.com/c/a/Miscellaneous/PHP-Output-Buffering/1/

More information about the wp-hackers mailing list