diff --git a/html/index.php b/html/index.php index c12614ca33ca222c9f5fc43df9af469e1e3a283c..5659b9f38cf314ecbfceafcf2395a3735d1d37d6 100755 --- a/html/index.php +++ b/html/index.php @@ -100,8 +100,6 @@ if (!is_readable(CONFIG_DIR.'/'.CONFIG_FILE)) { $config = new config(CONFIG_DIR.'/'.CONFIG_FILE, $BASE_DIR); session::set('config', $config); -print_r($_SESSION); - session::set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL')); logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config'); /* Configuration was reloaded, so plist needs to be as well */ diff --git a/include/class_config.inc b/include/class_config.inc index 46e8954ab0eca6caac73a7cb4647d83301d396e2..e05b5e95cd5e7eed7527fd6d3d6259ee15a7cd77 100755 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -83,6 +83,33 @@ class config } } + public function __serialize (): array + { + return [ + 'config_found' => $this->config_found, + 'tags' => $this->tags, + 'level' => $this->level, + 'currentLocation' => $this->currentLocation, + 'current' => $this->current, + 'referrals' => $this->referrals, + 'data' => $this->data, + ]; + } + + public function __unserialize(array $data): void + { + $this->config_found = $data['config_found']; + $this->tags = $data['tags']; + $this->level = $data['level']; + $this->currentLocation = $data['currentLocation']; + $this->current = $data['current']; + $this->referrals = $data['referrals']; + $this->data = $data['data']; + + // Recreate the XML parser + $this->parser = xml_parser_create(); + } + /*! * \brief Check and reload the configuration * diff --git a/include/class_session.inc b/include/class_session.inc index 286d14cced48aab0c04343a864e1be800fd192a9..5db5e9aabdd094e73c779735f3ea0ace681455b4 100755 --- a/include/class_session.inc +++ b/include/class_session.inc @@ -56,9 +56,6 @@ class session */ public static function set ($name, $value) { - if ($name === 'config') { - $value = pack('C',$value); - } $_SESSION[$name] = $value; } @@ -77,12 +74,7 @@ class session */ public static function get ($name) { - if ($name === 'config') { - if (isset($_SESSION['config'])) { - return unpack('C', $_SESSION[$name]); - } - } - else if (isset($_SESSION[$name])) { + if (isset($_SESSION[$name])) { return $_SESSION[$name]; } else { return NULL;