English 中文(简体)
Cakephp is not redirecting properly when pages are cached
原标题:

I am having some issues with a site that was working correctly until i implemented full page caching in CakePHP.

I have followed the guidance in the Manual and have my $session->flash in a no-cache block as so:

<cake:nocache>
    <? 
    if($session->check( Message.flash )){
        $session->flash();
    } 
    ?>
</cake:nocache>

However, whenever a controller sets a flash message and redirects to a cached page the page loads down to the tag and then gives the error:

Notice (8): Trying to get property of non-object
[CORE/cake/libs/view/helpers/session.php, line 145]

Fatal error: Call to undefined method stdClass::renderLayout() in
/home/decipherd/domains/example.com/public_html/beta/cake/libs/view/helpers/session.php
on line 14

If i then go to a page created by another controller the correct (delayed) message is displayed and the page loads correctly.

I have now submitted this to the CakePHP trac as ticket 282

问题回答

Sounds like it might be an issue with the core, have you tried submitting a bug report?

Are you sure that there is something in the flash message? Try:

debug($session->read());

OR to output it to the debug.log

$this->log($session->read(), LOG_DEBUG); // this might not work in the view?

Looking at the error message, it seems as is SessionHelper is not available for some reason.

I am not sure why exactly, this helper is usually loaded automatically when using AuthComponent or SessionComponent in your application.

Just a guess, but it might be worth putting $helpers = array( Session , ...); in your problem controller or AppController for good measure.

You can inspect everything available to your view with debug($this);

Ultimately, I would take Matt s advice and upgrade to the latest stable version anyway.





相关问题
Write-though caching of large data sets in WCF?

We ve got a smart client that talks to a SQL Server database via WCF, displaying the entities in the database, and allowing the user to edit those entities. Some of the WCF calls return a large data ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

how to tell clicking "back" to load cache?

I would like for my site when someone clicks "Back" or "Forward" for the server to tell the browser to load the cache instead of reloading the entire page. I ve tested some headers and done research, ...

java plugin cache and dynamic IP host

I m trying to use Amazon S3 and Amazon Cloudfront CDN to deliver the jar files of my applet application. I m seeing several cache misses of my jars by the java plugin. This is a show-stopper for me, ...

Frequently Used metadata Hashmap

Are there any implementations of a static size hashtable that limits the entries to either the most recently or most frequently used metadata? I would prefer not to keep track of this information ...

PHP - Memcache - HTML Caching

I would like to create a caching system that will bypass some mechanisms in order to improve the performance. I have some examples: 1-) I have a dynamic PHP page that is updated every hour. The page ...

Performance of Sql subqueriesfunctions

I am currently working on a particularly complex use-case. Simplifying below :) First, a client record has a many-to-one relationship with a collection of services, that is, a single client may have ...

热门标签