Skip to content

Commit d1fc8eb

Browse files
committed
add variable
1 parent 97467e3 commit d1fc8eb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Illuminate/Cookie/Middleware/EncryptCookies.php

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

28+
/**
29+
* Indicates if cookies should be serialized.
30+
*
31+
* @var bool
32+
*/
33+
protected $serialize = false;
34+
2835
/**
2936
* Create a new CookieGuard instance.
3037
*
@@ -93,7 +100,7 @@ protected function decryptCookie($name, $cookie)
93100
{
94101
return is_array($cookie)
95102
? $this->decryptArray($cookie)
96-
: $this->encrypter->decrypt($cookie, false);
103+
: $this->encrypter->decrypt($cookie, $this->serialize);
97104
}
98105

99106
/**
@@ -108,7 +115,7 @@ protected function decryptArray(array $cookie)
108115

109116
foreach ($cookie as $key => $value) {
110117
if (is_string($value)) {
111-
$decrypted[$key] = $this->encrypter->decrypt($value, false);
118+
$decrypted[$key] = $this->encrypter->decrypt($value, $this->serialize);
112119
}
113120
}
114121

@@ -129,7 +136,7 @@ protected function encrypt(Response $response)
129136
}
130137

131138
$response->headers->setCookie($this->duplicate(
132-
$cookie, $this->encrypter->encrypt($cookie->getValue(), false)
139+
$cookie, $this->encrypter->encrypt($cookie->getValue(), $this->serialize)
133140
));
134141
}
135142

0 commit comments

Comments
 (0)