Skip to content

Commit

Permalink
add variable
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 7, 2018
1 parent 97467e3 commit d1fc8eb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Illuminate/Cookie/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class EncryptCookies
*/
protected $except = [];

/**
* Indicates if cookies should be serialized.
*
* @var bool
*/
protected $serialize = false;

/**
* Create a new CookieGuard instance.
*
Expand Down Expand Up @@ -93,7 +100,7 @@ protected function decryptCookie($name, $cookie)
{
return is_array($cookie)
? $this->decryptArray($cookie)
: $this->encrypter->decrypt($cookie, false);
: $this->encrypter->decrypt($cookie, $this->serialize);
}

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

foreach ($cookie as $key => $value) {
if (is_string($value)) {
$decrypted[$key] = $this->encrypter->decrypt($value, false);
$decrypted[$key] = $this->encrypter->decrypt($value, $this->serialize);
}
}

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

$response->headers->setCookie($this->duplicate(
$cookie, $this->encrypter->encrypt($cookie->getValue(), false)
$cookie, $this->encrypter->encrypt($cookie->getValue(), $this->serialize)
));
}

Expand Down

0 comments on commit d1fc8eb

Please sign in to comment.