CakePHP flash messages not getting removed from session

234 views Asked by At

I have a sessions set to database storage in the following way

Configure::write('Session', array(
    'cookie'=>'SingleCase',
    'defaults' => 'database',
    'timeout' => 20,
    'autoRegenerate' => false,
    'cookieTimeout' => 20,
    'checkAgent'=>false
));

I have an AJAX application which also uses comet requests for push notifications. Every 60 seconds the request is renewed if there was no push notification, in this case it just returns empty array.

When I set a flash message, it gets properly rendered to the view.

The problem arises when I set a flash message and then do a redirect in the controller. The message is correctly rendered after the redirect, and everything works seemingly right but after the push notifications request is renewed, the flash message appears again, but just once and then it is gone until the next push notifications request.

To illustrate

  1. I do something to set flash message and do redirect
  2. View is rendered along with flash message correctly
  3. Meanwhile new request for push notifications is sent
  4. I do unspecified number of different actions
  5. Push notifications request is renewed
  6. Whatever action I do first, I get the flash message from point 2.
  7. Points 4 - 6 can be repeated forever.

Btw, any action renders all available flash messages by default, including the push notifications response .

0

There are 0 answers