Skip to content

Commit

Permalink
fix: Changes to the way a session is started. Resolves #547
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondas committed Mar 7, 2024
1 parent 4070d9f commit 84a7b0a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
2 changes: 2 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

require __DIR__ . '/vendor/autoload.php';

session_start();

$router = new BasicRouter(array_merge($_GET, $_POST));
$router->setDefaultPage('index');
$router->setPages([
Expand Down
8 changes: 0 additions & 8 deletions lib/Application/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function run(): void
$localesData = $this->localeRepository->getLocales();
$preparedLocales = $this->localeService->prepareLocales($localesData, $this->config('iface_lang'));

$this->initializeSession();
list($msg, $type) = $this->getSessionMessages();

if (!$this->config('ignore_install_dir') && file_exists('install')) {
Expand All @@ -60,13 +59,6 @@ public function run(): void
}
}

public function initializeSession(): void
{
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
}

public function getSessionMessages(): array
{
$msg = $_SESSION['message'] ?? '';
Expand Down
4 changes: 0 additions & 4 deletions lib/Domain/Service/SessionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@

class SessionService {
public function startSession(SessionEntity $sessionEntity): void {
if (session_status() === PHP_SESSION_NONE) {
session_start();
}

$this->setSessionData($sessionEntity);
}

Expand Down
5 changes: 2 additions & 3 deletions lib/LegacyApplicationInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class LegacyApplicationInitializer
public function __construct(bool $authenticate)
{
$this->checkConfigurationFile();
$this->initializeSessionAndDependencies();
$this->checkDependencies();
$this->loadConfiguration();
$this->connectToDatabase();
if ($authenticate) {
Expand All @@ -54,9 +54,8 @@ private function checkConfigurationFile(): void
}
}

private function initializeSessionAndDependencies(): void
private function checkDependencies(): void
{
session_start();
DependencyCheck::verifyExtensions();
}

Expand Down

0 comments on commit 84a7b0a

Please sign in to comment.