Start session for Ajax debug support

Simplified session start with basic cookie params.

@return void
771738
private function sessionStart()
    {
        if (session_status() !== PHP_SESSION_ACTIVE) {
            $request = new Request;
            session_set_cookie_params(
                0,
                $request->getBasePath(),
                null,
                $request->getUri()->getScheme() === 'https',
                true
            );
            session_start();
        }
    }
659304
public function start():void
    {
        if ((!$this->isStarted() && null === $this->session) || ($this->isStarted() && null === $this->session)) {
            $this->initSessionConfig();
            if (!$this->isStarted()) {
                session_start();
            }
            $this->session = $_SESSION;
        }
    }
1349676
protected function _startSession()
    {
        $name     = md5($this->getCfg('secret') . get_class($this));
        $lifetime = $this->getCfg('lifetime') * 60 ;
        $handler  = $this->getCfg('session_handler', 'none');

        $options = array(
            'name' => $name,
            'expire' => $lifetime
        );

        $session = JSession::getInstance($handler, $options);
        $session->initialise($this->input, $this->dispatcher);

        if ($session->getState() == 'expired') {
            $session->restart();
        } else {
            $session->start();
        }

        return $session;
    }
85225
public function start():void {
		$server = new ServerInfo($_SERVER);

		$cwd = dirname($server->getDocumentRoot());
		chdir($cwd);

		$config = ConfigFactory::createForProject(
			$cwd,
			implode(DIRECTORY_SEPARATOR, [
				dirname(__DIR__),
				"config.default.ini",
			])
		);

		$input = new Input($_GET, $_POST, $_FILES);
		$cookie = new CookieHandler($_COOKIE);

		$sessionHandler = SessionSetup::attachHandler(
			$config->get("session.handler")
		);
		$sessionConfig = $config->getSection("session");
		$sessionId = $cookie[$sessionConfig["name"]];
		$sessionHandler = new Session(
			$sessionHandler,
			$sessionConfig,
			$sessionId
		);

		$databaseSettings = new Settings(
			$config->get("database.query_directory"),
			$config->get("database.driver"),
			$config->get("database.schema"),
			$config->get("database.host"),
			$config->get("database.port"),
			$config->get("database.username"),
			$config->get("database.password")
		);
		$database = new Database($databaseSettings);

		$this->protectGlobals();
		$this->attachAutoloaders(
			$server->getDocumentRoot(),
			$config->getSection("app")
		);

		$request = $this->createServerRequest(
			$server,
			$input,
			$cookie
		);

		$router = $this->createRouter(
			$request,
			$server->getDocumentRoot()
		);

		$csrfProtection = new SessionTokenStore(
			$sessionHandler->getStore(
				"gt.csrf",
			true
			)
		);
		$csrfProtection->processAndVerify(
			$input->getAll(Input::DATA_BODY)
		);

		$dispatcher = $this->createDispatcher(
			$config,
			$server,
			$input,
			$cookie,
			$sessionHandler,
			$database,
			$router,
			$csrfProtection
		);

		$response = $this->process($request, $dispatcher);
		$this->finish($response);
	}
140522
public static function start(ServerRequestInterface $request): void
    {
        // Store sessions in the database
        session_set_save_handler(new SessionDatabaseHandler($request));

        $url    = (string) $request->getUri();
        $secure = parse_url($url, PHP_URL_SCHEME) === 'https';
        $domain = parse_url($url, PHP_URL_HOST);
        $path   = parse_url($url, PHP_URL_PATH);

        // Paths containing UTF-8 characters need special handling.
        $path = implode('/', array_map('rawurlencode', explode('/', $path)));

        session_name('WT_SESSION');
        session_register_shutdown();
        session_set_cookie_params(0, $path, $domain, $secure, true);
        session_start();

        // A new session? Prevent session fixation attacks by choosing a new session ID.
        if (!self::get('initiated')) {
            self::regenerate(true);
            self::put('initiated', true);
        }
    }
503802
protected function startSession()
    {
        if (session_status() == PHP_SESSION_NONE) {

            session_start();

            if(!$this->expireOnClose) {
                setcookie('planet_session', session_id(), time() + ($this->expireTime * 60 ), '/', null, false, false);
            }
        }
    }
1162646
private function loadSession() {

		$session = &$_SESSION;
		
		$this->sessionDataBag->initialize($session);

		$this->started = TRUE;

	}
999599
protected function setUpSession () {
		if ($this->session === NULL) {
			$sessionClass = $this->application->GetSessionClass();
			$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
			$this->session = $sessionClass::GetNamespace($selfClass);
			$this->session->SetExpirationSeconds($this->sessionExpirationSeconds);
		}
	}
872021
public static function run()
    {
        if (! session_id()) {
            session_start();
        }

        $complementType = self::getType('strtoupper');

        $path = App::$complementType();

        if ($paths = File::getFilesFromDir($path)) {
            foreach ($paths as $path) {
                if (! $path->isDot() && $path->isDir()) {
                    $_path = Url::addBackSlash($path->getPath());
                    $slug = $path->getBasename();
                    $file = $_path . $slug . '/' . $slug . '.json';
                    if (! File::exists($file)) {
                        continue;
                    }
                    self::load($file);
                }
            }
        }

        self::requestHandler(self::getType('strtolower', false));
    }
1335536
public function start()
    {
        if ($this->isStart) {
            return;
        }

        $this->startAt = time();
        $this->stopAt  = null;
        $this->isStart = true;

        if (extension_loaded('xdebug')) {
            xdebug_disable();
        }

        foreach ($this->onStart as $callable) {
            call_user_func_array($callable, []);
        }

        while ($this->isStart) {
            $this->tick();
        }

        $this->stopAt = time();

        foreach ($this->onStop as $callable) {
            call_user_func_array($callable, []);
        }

        if (extension_loaded('xdebug')) {
            xdebug_enable();
        }
    }
1125346
private function initialSessionStart()
    {
        if (!is_null($this->decoy)) {
            $this->decoy->throwDecoys();
        }
        $_SESSION['__HANDLER_INITIATED'] = true;
        return false;
    }
1150650
public function should_start_session() {
		$start_session = true;
		if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
			$blacklist = $this->get_blacklist();
			$uri       = ltrim( $_SERVER['REQUEST_URI'], '/' );
			$uri       = untrailingslashit( $uri );
			if ( in_array( $uri, $blacklist ) ) {
				$start_session = false;
			}
			if ( false !== strpos( $uri, 'feed=' ) ) {
				$start_session = false;
			}
		}
		if ( isset( $_GET['page'] ) && 'geot-debug-data' == $_GET['page'] ) {
			$start_session = false;
		}

		return apply_filters( 'geot/sessions/start_session', $start_session );
	}
788021
async def sessionstart(self):
        ""
        if not hasattr(self, 'session') or not self.session:
            self.session, setcookies = await call_api(self.container, 'session', 'start', {'cookies':self.rawcookie})
            for nc in setcookies:
                self.sent_cookies = [c for c in self.sent_cookies if c.key != nc.key]
                self.sent_cookies.append(nc)
955291
public function sessionStart()
    {
        if ( $this->storage && !$this->storage->isStarted() )
        {
            $this->storage->start();
        }

        return true;
    }
1210384
public function initNewSession()
    {
        // starting session only if it was not started yet
        if (self::$_blIsNewSession) {
            $this->_sessionStart();
        }

        //saving persistent params if old session exists
        $aPersistent = [];
        foreach ($this->_aPersistentParams as $sParam) {
            if (($sValue = $this->getVariable($sParam))) {
                $aPersistent[$sParam] = $sValue;
            }
        }

        $this->_setSessionId($this->_getNewSessionId());

        //restoring persistent params to session
        foreach ($aPersistent as $sKey => $sParam) {
            $this->setVariable($sKey, $aPersistent[$sKey]);
        }

        $this->_initNewSessionChallenge();

        // (re)setting actual user agent when initiating new session
        $this->setVariable("sessionagent", \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getServerVar('HTTP_USER_AGENT'));
    }
777858
protected function startSession()
    {
        if (session_status() === \PHP_SESSION_ACTIVE) {
            throw new \RuntimeException('Session already started by PHP.');
        }

        if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
            throw new \RuntimeException(sprintf('Unable to start session, headers have already been sent by "%s" at line %d.', $file, $line));
        }

        if (!session_start()) {
            throw new \RuntimeException('Unable to start session');
        }
    }
562727
public function start()
    {
        if ($this->active)
            return $this;

        if (PHP_SAPI === "cli")
        {
            $this->startCLISession();
        }
        else
        {
            // @codeCoverageIgnoreStart
            $this->startHTTPSession();
            // @codeCoverageIgnoreEnd
        }

        if (!$this->has('session_mgmt', 'start_time'))
            $this->set('session_mgmt', 'start_time', time());

        return $this;
    }