I am having some problems with a website that is working correctly until I have fully cached the pages in CakePHP.
I followed the instructions in the manual and had my $ session-> flash session in a block without a cache:
<cake:nocache> <? if($session->check('Message.flash')){ $session->flash(); } ?> </cake:nocache>
However, whenever the controller sets a flash message and redirects to a cached page, the page loads before the tag and then gives an 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 you then go to the page created by another controller, the correct (pending) message is displayed and the page loads correctly.
Now I sent this to CakePHP trac as ticket 282
source share