6263 /**64 * Start the session the first time some component request the session service65 */66 $di->setShared('session', function () {67 $session = new Manager();68 $files = new Stream([69 'savePath' => session_save_path(),70 'prefix' => 'sess_',71 ]);72 $session->setAdapter($files);73 $session->start()74 // Set session response cookie, unfortunalty we need to read the config here to determine if secure option is75 // a valid choice.76 $cnf = Config::getInstance();77 if ((string)$cnf->object()->system->webgui->protocol == 'https') {78 $secure = true;79 } else {80 $secure = false;81 }82 setcookie(session_name(), session_id(), null, '/', null, $secure, true);8384 return $session;85 });86