Compare commits

...
2 Commits
2 changed files with 7 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
"authors": [
{
"name": "Dave Mc Nicoll",
"email": "dave.mcnicoll@cslsj.qc.ca"
"email": "info@mcnd.ca"
}
],
"autoload": {
+6 -4
View File
@@ -32,7 +32,7 @@ class Cookie {
* @return boolean
*/
public function set(
?string $name,
?string $key,
?string $value = null,
?int $expires = null,
?string $path = null,
@@ -47,9 +47,11 @@ class Cookie {
return false;
}
$key = $this->normalizeKey($key);
$expires = ! $expires ? 0 : time() + (int) $expires;
$_COOKIE[$name] = $value;
$_COOKIE[$key] = $value;
$options = [
'expires' => $this->options['expires'] ?? ( $expires ?: 0 ),
@@ -64,7 +66,7 @@ class Cookie {
$value = sha1($this->secureHash . $value . $this->secureHash) . "|$value";
}
return $raw ? setrawcookie($name, $value ?: "", $options) : setcookie($name, $value ?: "", $options);
return $raw ? setrawcookie($key, $value ?: "", $options) : setcookie($key, $value ?: "", $options);
}
/**
@@ -161,6 +163,6 @@ class Cookie {
protected function normalizeKey(string $key) : string
{
return str_replace(['.', ' ',], '_', $key);
return str_replace([',', ';', ' ', '='], '_', $key);
}
}