Welcome Guest, Not a member yet? Register   Sign In
ci_sessions set_cookie() printing to screen
#1

[eluser]smatakajr[/eluser]
Hi,

I found a bug with the sessions, apparently when you call

set_userdata() and that calls sess_write()

When you have this config

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = TRUE; <--
$config['sess_use_database'] = true;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;

When the sess_write calls the set_cookie() function
it prints the encrypted cookie code on the screen and exits

When you set this config to False

$config['sess_encrypt_cookie'] = FALSE; <--

This behavior does not occur. Also if you leave
these configs blank

$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "";

In conjunction with the encrypt cookie call
it produces the same behavior.

I didnt get to fix that acctaul code just changed the
config settings. But i noticed you call set_cookie
explicitly in the sess_write() function. Maybee
if you encapsulate this within another method
and do a check for failure with @ suppression
maybee the code will not just exit?

Thanks
Rick
#2

[eluser]simshaun[/eluser]
Try setting $config['cookie_path'] = "/";
#3

[eluser]smatakajr[/eluser]
I do have all these filled correctly.. i was just saying that in the example above

Rick
#4

[eluser]simshaun[/eluser]
You must have something setup different either at CI's level or the server's.
I'm running the exact same config as your post above and its working fine for me.
#5

[eluser]simshaun[/eluser]
Also, have you set $config['encryption_key'] ?
#6

[eluser]smatakajr[/eluser]
ahhh maybee that is the problem, see im new to CI and I took over a
previous developers buggy code.. so when this was happining I hunted it
down to the sess_write() function. Because when I set the configh for the cookie
to not be encrypted the suddle set_cookie: echo and page exits stopped.

I will definitly try that config though.

Thanks
Rick




Theme © iAndrew 2016 - Forum software by © MyBB