From 2d5be738200159fc843f5494ffda23e9762ac568 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Wed, 6 Jun 2018 22:58:29 -0500 Subject: [PATCH] Cannot unpack arrays with string keys. Fixes #1057 --- system/HTTP/Response.php | 3 +++ system/Helpers/cookie_helper.php | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/HTTP/Response.php b/system/HTTP/Response.php index 8abfda7a6d8f..44791bbc45c1 100644 --- a/system/HTTP/Response.php +++ b/system/HTTP/Response.php @@ -922,6 +922,9 @@ protected function sendCookies() foreach ($this->cookies as $params) { + // PHP cannot unpack array with string keys + $params = array_values($params); + setcookie(...$params); } } diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php index d4c09f7aa870..346404b613e8 100755 --- a/system/Helpers/cookie_helper.php +++ b/system/Helpers/cookie_helper.php @@ -73,10 +73,7 @@ function set_cookie($name, string $value = '', string $expire = '', string $doma // The following line shows as a syntax error in NetBeans IDE //(\Config\Services::response())->setcookie $response = \Config\Services::response(); - $response->setcookie - ( - $name, $value, $expire, $domain, $path, $prefix, $secure, $httpOnly - ); + $response->setcookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httpOnly); } }