Skip to content

Commit

Permalink
Pulling 'session_start_options' app settings and injecting it into al…
Browse files Browse the repository at this point in the history
…l calls to session_start()
  • Loading branch information
rotimi committed May 23, 2024
1 parent 1b2f691 commit 71a7c28
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,14 @@ public function updateSelectedLanguage() : void {
*/
$this->vespula_locale->setCode($query_params[self::GET_QUERY_PARAM_SELECTED_LANG]);

if (session_status() !== \PHP_SESSION_ACTIVE) { session_start($this->getAppSetting('session_start_options') ?? []); }
if (session_status() !== \PHP_SESSION_ACTIVE) {

$session_start_settings =
$this->getAppSetting('session_start_options') !== null
? (array)$this->getAppSetting('session_start_options')
: [];
session_start($session_start_settings);
}

// also store in session
/**
Expand Down Expand Up @@ -739,7 +746,14 @@ protected function doLogin(\Vespula\Auth\Auth $auth, array $credentials, string
}

//since we are successfully logged in, resume session if any
if (session_status() !== \PHP_SESSION_ACTIVE) { session_start($this->getAppSetting('session_start_options') ?? []); }
if (session_status() !== \PHP_SESSION_ACTIVE) {

$session_start_settings =
$this->getAppSetting('session_start_options') !== null
? (array)$this->getAppSetting('session_start_options')
: [];
session_start($session_start_settings);
}

} else {
/**
Expand Down Expand Up @@ -1019,7 +1033,11 @@ public function storeCurrentUrlForLoginRedirection(): self {
//start a new session if none exists
if(session_status() !== \PHP_SESSION_ACTIVE) {

session_start($this->getAppSetting('session_start_options') ?? []);
$session_start_settings =
$this->getAppSetting('session_start_options') !== null
? (array)$this->getAppSetting('session_start_options')
: [];
session_start($session_start_settings);
}

//store current url in session
Expand Down

0 comments on commit 71a7c28

Please sign in to comment.