Skip to content

Commit

Permalink
Don't pass NULL to setcookie(,,*), use 0 instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
donquixote committed Feb 24, 2023
1 parent 7117d50 commit 6f59191
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()) {
Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/AuthenticationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Hooks/UserHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('/')));

Expand Down

0 comments on commit 6f59191

Please sign in to comment.