Welcome Guest, Not a member yet? Register   Sign In
Weird session bug, flash data
#1

[eluser]Calvin Froedge[/eluser]
This is in a base controller:

$this->session->set_flashdata('item', 'value');
$message = $this->session->flashdata('item');
if($message !== false) { var_dump($message);exit;}

The expected result would be that on every request, the message set by the previous request would get var dumped and the program would exit. This doesn't happen.

I see the flash data in the db, but no juice on the code above. I do see in my logs that the session class is being initialized multiple times. Here is the db log:

DEBUG - 2012-02-28 15:23:17 --> Config Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Hooks Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Utf8 Class Initialized
DEBUG - 2012-02-28 15:23:17 --> UTF-8 Support Enabled
DEBUG - 2012-02-28 15:23:17 --> URI Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Router Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Output Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Security Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Input Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Global POST and COOKIE data sanitized
DEBUG - 2012-02-28 15:23:17 --> Language Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Language Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Config Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Loader Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Helper loaded: url_helper
DEBUG - 2012-02-28 15:23:17 --> Database Driver Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Helper loaded: form_helper
DEBUG - 2012-02-28 15:23:17 --> Form Validation Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Session Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Helper loaded: string_helper
DEBUG - 2012-02-28 15:23:17 --> Session routines successfully run
DEBUG - 2012-02-28 15:23:17 --> Controller Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Listing MX_Controller Initialized
DEBUG - 2012-02-28 15:23:17 --> Form Validation Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Session Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Session routines successfully run
DEBUG - 2012-02-28 15:23:17 --> Carabiner: Library initialized.
DEBUG - 2012-02-28 15:23:17 --> Config file loaded: application/third_party/carabiner/config/carabiner.php
DEBUG - 2012-02-28 15:23:17 --> Carabiner: config loaded from config file.
DEBUG - 2012-02-28 15:23:17 --> Carabiner: library configured.
DEBUG - 2012-02-28 15:23:17 --> File loaded: application/views/common/nav/main.php
DEBUG - 2012-02-28 15:23:17 --> File loaded: application/views/common/nav/subnav.php
DEBUG - 2012-02-28 15:23:17 --> Model Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Model Class Initialized
DEBUG - 2012-02-28 15:23:17 --> Model Class Initialized
DEBUG - 2012-02-28 15:23:17 --> File loaded: application/views/common/forms/button_group.php
DEBUG - 2012-02-28 15:23:17 --> File loaded: application/views/common/table.php
DEBUG - 2012-02-28 15:23:17 --> File loaded: application/modules/catalog/views/products/index.php
DEBUG - 2012-02-28 15:23:17 --> Carabiner: less file saved to /Users/calvinfroedge/htdocs/froedge/store/code/assets/cache/bootstrap.css
DEBUG - 2012-02-28 15:23:17 --> Carabiner: less file saved to /Users/calvinfroedge/htdocs/froedge/store/code/assets/cache/styles.css
DEBUG - 2012-02-28 15:23:17 --> File loaded: application/views/admin_template.php
DEBUG - 2012-02-28 15:23:17 --> Final output sent to browser
DEBUG - 2012-02-28 15:23:17 --> Total execution time: 0.1568

Anything jump out at you?
#2

[eluser]CroNiX[/eluser]
Make sure you are using a schema for your session table that matches the version of CI you are using...it has changed over the last few revisions.
#3

[eluser]Calvin Froedge[/eluser]
I'm using 2.1. The code posted here yielded no dice: http://ellislab.com/forums/viewthread/205783/
#4

[eluser]Calvin Froedge[/eluser]
You're right though....it is the session table....

Trying without db session storage works.
#5

[eluser]CroNiX[/eluser]
Try the schema from the current userguide for sessions. It's different.
#6

[eluser]Calvin Froedge[/eluser]
That was the first one I tried = )
#7

[eluser]Calvin Froedge[/eluser]
Hey though I know it's the database so it's debuggable now. I'll dig through the code and let you know what it was.
#8

[eluser]CroNiX[/eluser]
Might check in the session cookie setup in the config. If there is an underscore in the cookie name, I'd remove it. If sess_match_useragent is TRUE, I'd set it to FALSE.
#9

[eluser]Calvin Froedge[/eluser]
It's something to do with modular extensions. Big surprise there. Debugging...
#10

[eluser]Calvin Froedge[/eluser]
Well, the bug is actually introduced when trying to add support for Sparks (ie the modified MY_loader from which I was extending MX_Loader). That was also the root cause of some of the core classes being initialized twice (including the sessions class).

This guide, which provides modifications to the MX third party files, resulted in the same situation:

http://getsparks.org/set-up-mx

I think my best approach is to move on with my project and then write my own mechanism for loading sparks when I get to that point. Haven't slept in 24 hours and I'm not up to it at the moment = )

I'll post when I have a fix that works with sparks.




Theme © iAndrew 2016 - Forum software by © MyBB