From 6f59191aba57abefe2dda21055be11b75a4dc24d Mon Sep 17 00:00:00 2001 From: Andreas Hennings Date: Sat, 18 Feb 2023 20:28:14 +0100 Subject: [PATCH] Don't pass NULL to setcookie(,,*), use 0 instead. --- appinfo/app.php | 10 +++++----- lib/Controller/AuthenticationController.php | 4 ++-- lib/Hooks/UserHooks.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index edb8d30..1cf4a8c 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -56,18 +56,18 @@ $c->query('UserHooks')->register(); // URL params and redirect_url cookie - setcookie("user_cas_enforce_authentication", "0", null, '/'); + setcookie("user_cas_enforce_authentication", "0", 0, '/'); $urlParams = ''; if (isset($_REQUEST['redirect_url'])) { $urlParams = $_REQUEST['redirect_url']; // Save the redirect_rul to a cookie - $cookie = setcookie("user_cas_redirect_url", "$urlParams", null, '/'); + $cookie = setcookie("user_cas_redirect_url", "$urlParams", 0, '/'); }/* else { - setcookie("user_cas_redirect_url", '/', null, '/'); + setcookie("user_cas_redirect_url", '/', 0, '/'); }*/ // Register alternative LogIn @@ -88,7 +88,7 @@ $loggingService = $c->query("LoggingService"); $loggingService->write(LoggingService::DEBUG, 'Enforce Authentication was: ' . $isEnforced); - setcookie("user_cas_enforce_authentication", '1', null, '/'); + setcookie("user_cas_enforce_authentication", '1', 0, '/'); // Initialize app if (!$appService->isCasInitialized()) { @@ -101,7 +101,7 @@ $loggingService->write(LoggingService::DEBUG, 'Enforce Authentication was on and phpCAS is not authenticated. Redirecting to CAS Server.'); - $cookie = setcookie("user_cas_redirect_url", urlencode($requestUri), null, '/'); + $cookie = setcookie("user_cas_redirect_url", urlencode($requestUri), 0, '/'); header("Location: " . $appService->linkToRouteAbsolute($c->getAppName() . '.authentication.casLogin')); die(); diff --git a/lib/Controller/AuthenticationController.php b/lib/Controller/AuthenticationController.php index 78f59f3..f8c0c4b 100644 --- a/lib/Controller/AuthenticationController.php +++ b/lib/Controller/AuthenticationController.php @@ -165,7 +165,7 @@ public function casLogin() $this->loggingService->write(\OCA\UserCas\Service\LoggingService::DEBUG, "phpCAS user has been authenticated against owncloud."); # Reset cookie - setcookie("user_cas_redirect_url", '/', null, '/'); + setcookie("user_cas_redirect_url", '/', 0, '/'); return new RedirectResponse($location); } else { # Not authenticated against owncloud @@ -191,7 +191,7 @@ public function casLogin() $this->loggingService->write(\OCA\UserCas\Service\LoggingService::DEBUG, "phpCAS user is already authenticated against owncloud."); # Reset cookie - setcookie("user_cas_redirect_url", '/', null, '/'); + setcookie("user_cas_redirect_url", '/', 0, '/'); return new RedirectResponse($location); } diff --git a/lib/Hooks/UserHooks.php b/lib/Hooks/UserHooks.php index 01917dd..68bf83f 100644 --- a/lib/Hooks/UserHooks.php +++ b/lib/Hooks/UserHooks.php @@ -404,7 +404,7 @@ public function postLogout() $this->loggingService->write(\OCA\UserCas\Service\LoggingService::DEBUG, 'phpCAS logging out.'); # Reset cookie - setcookie("user_cas_redirect_url", '/', null, '/'); + setcookie("user_cas_redirect_url", '/', 0, '/'); \phpCAS::logout(array("service" => $this->appService->getAbsoluteURL('/')));