[wp-hackers] Form injection and gzipping

Eric A. Meyer eric at meyerweb.com
Tue Feb 28 02:59:16 GMT 2006

At 7:00 AM -0600 2/24/06, Andy Skelton wrote:

>To fix this, you have to understand that output buffers are FILO,
>meaning that if you start your buffer first, it will be the last one
>to be processed. Your buffer is started in the plugin. Examine
>wp-blog-header.php and you'll see that gzip_compression()'s buffer is
>started after all of wp-config has run--long after your plugin has
>started its buffer.

    That seems kind of silly.  Why would gzipping happen before all 
the other output buffers?  Why wouldn't it be the last thing done 
before the page is sent off?

>There's only one hook after gzip_compression, and it's template_redirect.
>Try this:
>add_action('template_redirect', 'ob_start', 'gatekeeper_comment_form_filter');

    Nope, didn't work with gzip enabled.  It worked just fine with 
gzip turned off, which is the usual experience.  Was I supposed to 
comment out the "ob_start('gatekeeper_comment_form_filter');" line, 
or no?  And should the first action I add, the one for _form_scan, be 
similarly hooked to template_redirect, or no?  I didn't see any 
difference in behavior either way, but maybe I missed the magic 
combination that would make it all work.

Eric A. Meyer  (eric at meyerweb.com)
Principal, Complex Spiral Consulting   http://complexspiral.com/
"CSS: The Definitive Guide," "CSS2.0 Programmer's Reference,"
"Eric Meyer on CSS," and more    http://meyerweb.com/eric/books/

More information about the wp-hackers mailing list