diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 77b330c0257bc..8b639af6e8672 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -46,7 +46,7 @@ class Cookie * Sets a cookie. * * @param string $name The cookie name - * @param string $value The value of the cookie + * @param string|null $value The value of the cookie * @param string|null $expires The time the cookie expires * @param string|null $path The path on the server in which the cookie will be available on * @param string $domain The domain that the cookie is available @@ -62,7 +62,7 @@ public function __construct(string $name, ?string $value, string $expires = null $this->rawValue = $value; } else { $this->value = $value; - $this->rawValue = rawurlencode($value); + $this->rawValue = rawurlencode($value ?? ''); } $this->name = $name; $this->path = empty($path) ? '/' : $path;