- Cookie were not working correctly previously, now fixed
This commit is contained in:
parent
ad51a435df
commit
fd547dc346
|
@ -47,7 +47,7 @@ class Cookie {
|
|||
return false;
|
||||
}
|
||||
|
||||
$expires = ( $expires === 0 ) ? 0 : time() + (int) $expires;
|
||||
$expires = ! $expires ? 0 : time() + (int) $expires;
|
||||
|
||||
$_COOKIE[$name] = $value;
|
||||
|
||||
|
@ -80,10 +80,14 @@ class Cookie {
|
|||
}
|
||||
|
||||
if ( $this->secureHash && ! $skipHash ) {
|
||||
if (strpos($_COOKIE[$key], '|') === false) {
|
||||
throw new Exception\CookieInvalidValueException("A cookie value was found which contains no secure hash while a key was provided.");
|
||||
}
|
||||
|
||||
list($hash, $value) = explode('|', $_COOKIE[$key], 2);
|
||||
|
||||
if (! $this->isSecure($hash, $value)) {
|
||||
throw new Exception\CookieInvalidSecureHashException();
|
||||
throw new Exception\CookieInvalidSecureHashException("Invalid cookie hash value given.");
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
@ -126,4 +130,24 @@ class Cookie {
|
|||
case 2: return $this->set(...$arguments);
|
||||
}
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
{
|
||||
return static::set($key, $value);
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
return static::get($key);
|
||||
}
|
||||
|
||||
public function __isset($key)
|
||||
{
|
||||
return array_key_exists($key, $_SESSION);
|
||||
}
|
||||
|
||||
public function __unset($key)
|
||||
{
|
||||
$this->delete($key);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue