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

Issue Type: Bug Created: 2008-07-29T12:31:36.000+0000 Last Updated: 2008-08-19T10:30:37.000+0000 Status: Resolved Fix version(s): - 1.6.1 (15/Sep/08)

Reporter: Jordan Ryan Moore (jordanryanmoore) Assignee: Fabien MARTY (fab) Tags: - Zend_Cache

Related issues: Attachments: - Page.php.patch


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.


Posted by Fabien MARTY (fab) on 2008-08-12T08:40:00.000+0000

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...

Posted by Jordan Ryan Moore (jordanryanmoore) on 2008-08-12T09:23:19.000+0000

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:

<pre class="highlight">
$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.

Posted by Fabien MARTY (fab) on 2008-08-13T00:39:41.000+0000

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 ?

Posted by Jordan Ryan Moore (jordanryanmoore) on 2008-08-13T09:53:28.000+0000

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

Posted by Fabien MARTY (fab) on 2008-08-14T01:47:42.000+0000

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


Posted by Jordan Ryan Moore (jordanryanmoore) on 2008-08-14T07:33:24.000+0000

Works like a charm now. Thank you.

Posted by Fabien MARTY (fab) on 2008-08-14T08:28:32.000+0000

fixed in 1.6 branch too (many thanks)

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.