• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ci_sessions set_cookie() printing to screen


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?


Try setting $config['cookie_path'] = "/";

I do have all these filled correctly.. i was just saying that in the example above


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.

Also, have you set $config['encryption_key'] ?

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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.