One of the XML sitemap plugins does this in the main plugin file, outside of any hook:
// Pre-emptive $foo_ob_level = @ob_get_level(); $foo_ob_start = ob_start();
Seems like bad practice. Ob is always on, even on admin pages. Prevents me from flush()’ing data on long admin tasks, for one thing.
The whole purpose is so the plugin can discard any stray output before outputting its XML sitemap. What should it be hooking on? It is already hooking the action ‘parse_request’ to trigger the sitemap.
IIRC, headers_sent() should be false at ‘parse_request’, with or without ob. Seems like the ob is not needed at all, just set the XML headers and go. Unless they are fighting some other plugin???
The other way to go is leave the ob_start() where it is but condition it on the right $_REQUEST vars. They’ve buried those names in some spaghetti code, with a filter on one of the variable names.
- The topic ‘Plugin does ob_start() universally. Bad practice?’ is closed to new replies.