lonnieezell / Bonfire

Jumpstart your CodeIgniter web applications with a modular, HMVC-ready, backend.
http://cibonfire.com
1.39k stars 524 forks source link

Flashdata doesn't seem to survive even a single request. #963

Closed jayarjo closed 10 years ago

jayarjo commented 10 years ago

In my case AJAX request is setting a flashdata that should be then retrieved on form submit, but by the time the request reaches a controller method flashdata is empty. If I test it in the Controller constructor, before any parent constructors are invoked, it's still there, but after parent controllers are done - it's gone.

jayarjo commented 10 years ago

Actually I've noticed it on another occasion as well - when trying to pass around user info retrieved from google.

Is Flashdata officially not working in Bonfire?

lonnieezell commented 10 years ago

I'll have to look into this because as far as I know Flash Messaging works fine, though I typically use the Template::set_message() and Template::message() methods to handle flash, since that allows for same-page-request messages and doesn't require a new page load to happen for the messages to be available. In some AJAX situations, though, you will have more than one request happening and the session message is lost during the second page request, so I don't know if that's a possibility or not.

You could try in a non-AJAX situation and see if it's working in that situation, or if any of the status messages within Bonfire are showing up for you, like when you edit a user in the admin area, or change settings, etc, since that all uses flash messaging, though most is by the Template class, come to think of it.

I have had situations before where CodeIgniter was having issues keeping it's session alive and was creating a new one every page request. There's many threads on their forums about that and StackOverflow. I found that using the database session variety can often fix that, though. Don't know if this is related or not.

jayarjo commented 10 years ago

Ok, looks like it was happening because of my custom MY_Loader. Actually it was not exactly custom, but a typical recommended for spark loading. It was ruining something fragile behind the scenes. I removed it now, since I decided to not use sparks.

Although as I was digging some time for the reasons, I noticed some dark magic going on to make HMVC thingy work... spooky...

lonnieezell commented 10 years ago

There is a bit of 'dark magic' going on behind the scenes for the all of the HMVC stuff. It's kind of a pain, actually. :)

I know that Sparks had an issue with the HMVC process and required some custom dark magic of it's own to work together. Before too long, I need to make our system compatible with Sparks, even though I'm not convinced of the longevity of Sparks, since I haven't been able to get new ones created over there, or get answers from current staff the last time I tried. Would still be good for all of the sparks already on there, though.