Bug Report #2225

Session regeneration

Added by Max 8080 over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:10/12/2009
Priority:NormalDue date:
Assignee:Isaiah DeRose-Wilson% Done:

0%

Category:Libraries:Session
Target version:2.4
Resolution:invalid Points:

Description

Hello Developers,

Can you please take this issue in to consideration.

http://forum.kohanaphp.com/comments.php?DiscussionID=3705&page=1#Item_7

Please go thr the thread your will get all information there.

Regards,

max8080.

History

#1 Updated by Isaiah DeRose-Wilson over 4 years ago

  • Category set to Libraries:Session
  • Assignee set to Isaiah DeRose-Wilson
  • Target version set to 2.4

It's a known issue. If you have automatic session regeneration enabled, and you have multiple requests at the same time (ajax, loading resources with Kohana, e.g. images, javascript, etc) that the session will be dropped. The problem is especially noticeable when you are using the database session driver. The best solution is to disable the automatic session id regeneration, and do it manually when when needed.

Session regeneration is disabled by default in Kohana 2.4+, and you can see more details about this in the docs here.

#2 Updated by Isaiah DeRose-Wilson over 4 years ago

Ack, double post!

#3 Updated by Isaiah DeRose-Wilson over 4 years ago

  • Status changed from New to Closed
  • Resolution set to invalid

If you have any questions about this, feel free to reopen this issue.

#4 Updated by Max 8080 over 4 years ago

  • Status changed from Closed to Feedback
  • Target version changed from 2.4 to 2.3

Again not working properly session got sign out. Kohana Version 2.3.4

$his->session = new Session;
$this->session->regenerate();

Still causing problem on IE -7 and 8 and Chrome.

#5 Updated by Isaiah DeRose-Wilson over 4 years ago

What session driver are you using? You should never use new Session, use Session::instance() when you need to get an instance of the session class. Are cookies working in IE/chrome? You only have problems when you regenerate the session?

I'm also guessing you didn't put that code in your __construct() or something that runs every time Kohana loads, because that would cause the same problems as automatic session regeneration. I'm not able to reproduce this error in IE or chrome with the latest trunk.

#6 Updated by Max 8080 over 4 years ago

Following is my cost snippets

class Myaccount_Controller extends Controller{

function _construct(){
parent::
_construct();
$this->session = new Session();
//Is this method wrong method.
$this->session->regenerate();
$this->memID = $this->session->get('memID');
if(!$this->session->get('memLogin_X')):
$this->session->set(array('error_msg'=>kohana::lang('custom_msg.session_expired_login_again')));
url::redirect('public/login');
endif;
$this->adv_listing_model = new Adv_listing_Model;
$this->profiler = new Profiler;
}

#7 Updated by Oscar Bajner over 4 years ago

Replace $this->session = new Session();
with
$this->session = Session::instance()

Comment out $this->session->regenerate(); and test with FF and IEx

If you get a valid session cookie in FF but not IE then the problem is not in Kohana.

IE can be more problematic sometimes, than FF in accepting cookies. Some things you can check are:
cookie / session configuration. Are the name, path and domain valid. eg '.example.com'
Is the server time correct.
Is PHP ini 'session.auto_start' value set to '0'

#8 Updated by Kiall Mac Innes over 4 years ago

  • Target version changed from 2.3 to 2.4

@Max 8080 - 2.3 has had its final release, the target version for this ticket should stay as 2.4

#9 Updated by Kiall Mac Innes over 4 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF