Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Session::exists() does not work with changed session_name #486

Merged
merged 1 commit into from

2 participants

@lm
lm commented
$session->setOptions(array('name' => 'mysessid'));
var_dump($session->exists());
$session->start();

Even after refreshing page output is false, because Sesssion::exists() is checking for cookie named PHPSESSID instead of myssesid.

There is alternative fix lm@a6fe396.

@dg dg merged commit ccbc3fe into nette:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 Nette/Http/Session.php
View
4 Nette/Http/Session.php
@@ -223,7 +223,7 @@ public function destroy()
*/
public function exists()
{
- return self::$started || $this->request->getCookie(session_name()) !== NULL;
+ return self::$started || $this->request->getCookie($this->getName()) !== NULL;
}
@@ -284,7 +284,7 @@ public function setName($name)
*/
public function getName()
{
- return session_name();
+ return isset($this->options['name']) ? $this->options['name'] : session_name();
}
Something went wrong with that request. Please try again.