Skip to content

Commit 97467e3

Browse files
committed
disable serialization for all cookies
1 parent 7c90d41 commit 97467e3

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/Illuminate/Cookie/Middleware/EncryptCookies.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ class EncryptCookies
2525
*/
2626
protected $except = [];
2727

28-
/**
29-
* The cookies that should not be serialized.
30-
*
31-
* @var array
32-
*/
33-
protected $serialization = [
34-
'XSRF-TOKEN' => false,
35-
];
36-
3728
/**
3829
* Create a new CookieGuard instance.
3930
*
@@ -43,8 +34,6 @@ class EncryptCookies
4334
public function __construct(EncrypterContract $encrypter)
4435
{
4536
$this->encrypter = $encrypter;
46-
47-
$this->serialization[config('session.cookie')] = false;
4837
}
4938

5039
/**
@@ -104,7 +93,7 @@ protected function decryptCookie($name, $cookie)
10493
{
10594
return is_array($cookie)
10695
? $this->decryptArray($cookie)
107-
: $this->encrypter->decrypt($cookie, $this->serialization[$name] ?? true);
96+
: $this->encrypter->decrypt($cookie, false);
10897
}
10998

11099
/**
@@ -119,7 +108,7 @@ protected function decryptArray(array $cookie)
119108

120109
foreach ($cookie as $key => $value) {
121110
if (is_string($value)) {
122-
$decrypted[$key] = $this->encrypter->decrypt($value, $this->serialization[$key] ?? true);
111+
$decrypted[$key] = $this->encrypter->decrypt($value, false);
123112
}
124113
}
125114

@@ -139,10 +128,8 @@ protected function encrypt(Response $response)
139128
continue;
140129
}
141130

142-
$serialize = $this->serialization[$cookie->getName()] ?? true;
143-
144131
$response->headers->setCookie($this->duplicate(
145-
$cookie, $this->encrypter->encrypt($cookie->getValue(), $serialize)
132+
$cookie, $this->encrypter->encrypt($cookie->getValue(), false)
146133
));
147134
}
148135

0 commit comments

Comments
 (0)