Skip to content

Commit

Permalink
php7.1 session key length fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Çetin authored and Ali Çetin committed Jan 18, 2017
1 parent 1acaa67 commit 5beecd7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions system/Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ public function start()

$this->setSaveHandler();

// Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers
// Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers
if (isset($_COOKIE[$this->sessionCookieName]) && (
! is_string($_COOKIE[$this->sessionCookieName]) || ! preg_match('#\A'.$this->sidRegexp.'\z#', $_COOKIE[$this->sessionCookieName]))
! is_string($_COOKIE[$this->sessionCookieName]) || ! preg_match('#\A'.$this->sidRegexp.'\z#', $_COOKIE[$this->sessionCookieName])
)
)
{
unset($_COOKIE[$this->sessionCookieName]);
Expand Down Expand Up @@ -302,10 +303,10 @@ protected function configure()
ini_set('session.use_strict_mode', 1);
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);

$this->configureSidLength();
}

// ------------------------------------------------------------------------

/**
Expand Down Expand Up @@ -822,7 +823,7 @@ public function removeTempdata($key)
*
* @param $key Property identifier or array of them
* @param int $ttl Time to live, in seconds
* @return bool false if any of the properties were not set
* @return bool False if any of the properties were not set
*/
public function markAsTempdata($key, $ttl = 300)
{
Expand Down Expand Up @@ -922,8 +923,6 @@ public function getTempKeys()
return $keys;
}

//--------------------------------------------------------------------

/**
* Sets the driver as the session handler in PHP.
* Extracted for easier testing.
Expand Down

0 comments on commit 5beecd7

Please sign in to comment.