Merge branch 'ent-3143-mobile-console-session-unserialize-bugfix' into 'develop'

Fixed an object unserialize from the session

See merge request artica/pandorafms!2012
This commit is contained in:
vgilc 2018-11-23 10:49:58 +01:00
commit 47a1635916
2 changed files with 12 additions and 8 deletions

View File

@ -23,9 +23,7 @@ class System {
$this->loadConfig(); $this->loadConfig();
$session_id = session_id(); $session_id = session_id();
DB::getInstance($this->getConfig('db_engine', 'mysql')); DB::getInstance($this->getConfig('db_engine', 'mysql'));
if (empty($session_id)) { if (session_status() === PHP_SESSION_NONE) session_start();
session_start();
}
$this->session = $_SESSION; $this->session = $_SESSION;
session_write_close(); session_write_close();
@ -71,7 +69,7 @@ class System {
} }
public function setSessionBase($name, $value) { public function setSessionBase($name, $value) {
session_start(); if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION[$name] = $value; $_SESSION[$name] = $value;
session_write_close(); session_write_close();
} }
@ -79,7 +77,7 @@ class System {
public function setSession($name, $value) { public function setSession($name, $value) {
$this->session[$name] = $value; $this->session[$name] = $value;
session_start(); if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION = $this->session; $_SESSION = $this->session;
session_write_close(); session_write_close();
} }
@ -94,7 +92,7 @@ class System {
} }
public function sessionDestroy() { public function sessionDestroy() {
session_start(); if (session_status() === PHP_SESSION_NONE) session_start();
session_destroy(); session_destroy();
} }

View File

@ -19,13 +19,20 @@ if (function_exists ('mb_internal_encoding')) {
} }
$develop_bypass = 0; $develop_bypass = 0;
require_once '../include/config.php';
require_once("include/ui.class.php"); require_once("include/ui.class.php");
require_once("include/system.class.php"); require_once("include/system.class.php");
require_once("include/db.class.php"); require_once("include/db.class.php");
require_once("include/user.class.php"); require_once("include/user.class.php");
/* Info:
* The classes above doesn't start any session before it's properly
* configured into the file below, but it's important the classes
* exist at the time the session is started for things like
* serializing objects stored into the session.
*/
require_once '../include/config.php';
require_once('operation/home.php'); require_once('operation/home.php');
require_once('operation/tactical.php'); require_once('operation/tactical.php');
require_once('operation/groups.php'); require_once('operation/groups.php');
@ -78,7 +85,6 @@ $system = System::getInstance();
require_once($system->getConfig('homedir').'/include/constants.php'); require_once($system->getConfig('homedir').'/include/constants.php');
$user = User::getInstance(); $user = User::getInstance();
$user->saveLogin(); $user->saveLogin();
$default_page = 'home'; $default_page = 'home';