From ffb1881527812aedda0f4be9e0fbd4dde747d094 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 8 Aug 2018 20:14:31 +0200 Subject: [PATCH] app/library/Services.php: add use session.path instead of application.sessionDir in _initSession() --- app/library/Services.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/library/Services.php b/app/library/Services.php index 00e0e6c..6d92a99 100644 --- a/app/library/Services.php +++ b/app/library/Services.php @@ -189,19 +189,20 @@ class Services extends DiDefault if (isset($config->session)) { $data = $config->session->toArray(); - $adapter = $data['adapter']; + $adapter = isset($data['adapter']) ? $data['adapter'] : 'Files'; $options = $data['options']; + // For "Files": Set session path if defined. + if ($adapter === 'Files' && isset($options['path'])) { + session_save_path($config->application->path); + } + $class = 'Phalcon\Session\Adapter\\' . $adapter; $session = new $class($options); } // Default to File storage else { - // Set session directory if defined. - if (isset($config->application->sessionDir)) { - session_save_path($config->application->sessionDir); - } - $session = new SessionAdapter(); + $session = new \Phalcon\Session\Adapter\Files(); } // Start session.