ZF-3803: Zend_Cache_Frontend_Page shouldn't check if headers have been sent


I currently have an application that won't cache headers unless I remove the check for headers_sent().

headers_sent() should not be checked in Zend_Cache_Frontend_Page since headers have not been sent if output buffering is enabled. headers_list() provides the list of headers regardless if they have been sent or not, so it's safe to call headers_list() regardless.


may you provide a patch for this ?

I don't really understand why it's a critical bug ?

What options do you use for the frontend ?

It sounds to be a very specific problem...

It's a critical bug because when I tell the page cache to memorize headers (or just the content-type header for 1.5.3), it doesn't. The code below is from my bootstrap:

$myPageCache = new Zend_Cache_Frontend_Page(array(
    'content_type_memorization' => true,
    'default_options'           => array(
        'cache' => false,
    'regexps'                   => array(
        '^' . $myConfig->baseUrl . '/~(.*?)/(.*)$' => array(
            'cache'                             => true,
            'cache_with_session_variables'      => true,
            'cache_with_cookie_variables'       => true,
            'make_id_with_get_variables'        => false,
            'make_id_with_post_variables'       => false,
            'make_id_with_session_variables'    => false,
            'make_id_with_files_variables'      => false,
            'make_id_with_cookie_variables'     => false,


With the current Zend_Cache_Frontend_Page from 1.5.3, 1.6RC2, or trunk, headers aren't cached. If I apply the patch that I've attached, headers are cached correctly.

ok, and you use output buffering (by yourself) + Zend_Cache_Frontend_Page (which use output buffering too)

and using both reach to this bug ? I'm right ?

Nope. I'm not starting any output buffering other than what's started by Zend_Cache_Frontend_Page.

ok, I just commited your fix into SVN trunk

can you confirm it's ok four you with the SVN trunk ?

if it's ok, I will fix this on the 1.6 branch too


Works like a charm now. Thank you.

fixed in 1.6 branch too (many thanks)