-
-
Save mbabker/f79242fd1afccf1ca645 to your computer and use it in GitHub Desktop.
Using https://github.com/joomla/joomla-cms/pull/5088 as a starting point, the JSessionHandlerJoomla method that does not read from JInputCookie works as expected on PHP 7 however the method using JInputCookie always fails to correctly start a session.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function start() | |
{ | |
$session_name = $this->getName(); | |
// Get the JInputCookie object | |
$cookie = $this->input->cookie; | |
if (is_null($cookie->get($session_name))) | |
{ | |
$session_clean = $this->input->get($session_name, false, 'string'); | |
if ($session_clean) | |
{ | |
$this->setId($session_clean); | |
$cookie->set($session_name, '', time() - 3600); | |
} | |
} | |
return parent::start(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function start() | |
{ | |
$session_name = $this->getName(); | |
if (isset($_COOKIE[$session_name]) && is_null($_COOKIE[$session_name])) | |
{ | |
$session_clean = $this->input->get($session_name, false, 'string'); | |
if ($session_clean) | |
{ | |
$this->setId($session_clean); | |
setcookie($session_name, '', time() - 3600); | |
} | |
} | |
return parent::start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment