Yii Framework Forum: Cookie Problem Or Just Me? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cookie Problem Or Just Me? Rate Topic: -----

#1 User is offline   rapidtransit440 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 29-March 10

Posted 03 October 2012 - 08:06 PM

From my config/main.php
'session' => array (
                        'class' => 'system.web.CDbHttpSession',
                        'connectionID' => 'db',
                        'sessionTableName' => 'tbl_user_sessions',
                        'cookieMode' => 'only',
                        'cookieParams'=>array(60*60*24*30,'/','',true, true),
                        'sessionName' => 'shopSession',
                        
                ),


Cookie settings are not set under 'cookieParams'

In CHttpSession.php Line 238
public function setCookieParams($value)
	{
		$data=session_get_cookie_params();
		extract($data);
		extract($value);
		if(isset($httponly))
			session_set_cookie_params($lifetime,$path,$domain,$secure,$httponly);
		else
			session_set_cookie_params($lifetime,$path,$domain,$secure);
	}


I came across the following:
From http://us2.php.net/m...okie-params.php

Quote

quintellarosa at yahoo dot com dot br 25-Feb-2010 06:27
Thanks to dan at vespernet dot co dot uk and MaxTheDragon at NOSPAMhome dot nl, I've started solving some issues here.

I've found that using:

<?php

session_name($name);
setcookie($name, $_COOKIE[$name], time() + $lifetime, $path, $domain, $secure, $httponly);
session_start();

?>

works fine, while:

<?php

session_name($name);
session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
session_start();

?>

doesn't seem to work properly, like not updating the lifetime properly.

For anyone interested. Any comments would be appreciated.



Further searching came up with this also:
http://stackoverflow...re-not-affected
0

#2 User is offline   Jorgee 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 58
  • Joined: 22-March 13

Posted 16 April 2013 - 03:01 PM

What about if you set sessionName first, before cookie params.

I've read that session name is needed or something weird happens.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users