I use output buffering for gzip compression and access to what was put out before in a PHP script:
if(!ob_start("ob_gzhandler")) ob_start();
Now if that script gets included in another script where ob_start() already is in use I get a warning:
Warning: ob_start() [ref.outcontrol]: output handler ‘ob_gzhandler’ cannot be used twice in filename on line n
So I’d like to test whether ob_start() has already been called. I think ob_get_status() should be what I need but what is the best way to use it in testing for this?
ob_get_levelreturns the number of active output control handlers andob_list_handlersreturns a lift of those handlers. So you could do this:Although in general you can call
ob_startany number of times you want, usingob_gzhandleras handler cannot as you would compress already compressed data.