Starts session

@throws \RuntimeException
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');
        }
    }
1008232
public function start()
	{
		if ($this->getState() === 'active')
		{
			return;
		}

		$this->_start();

		$this->setState('active');

		// Initialise the session
		$this->_setCounter();
		$this->_setTimers();

		// Perform security checks
		$this->_validate();

		if ($this->dispatcher instanceof DispatcherInterface)
		{
			$this->dispatcher->triggerEvent('onAfterSessionStart');
		}
	}
1340484
public function run()
    {

        try {
            // register the default autoloader
            require SERVER_AUTOLOADER;

            // register shutdown handler
            set_error_handler(array(&$this, 'errorHandler'));
            register_shutdown_function(array(&$this, 'shutdown'));

            // initialize the array for the errors
            $this->errors = array();

            // synchronize the application instance and register the class loaders
            $application = $this->application;
            $application->registerClassLoaders();

            // register the applications annotation registries
            $application->registerAnnotationRegistries();

            // synchronize the valves, servlet request/response
            $valves = $this->valves;
            $servletRequest = $this->servletRequest;
            $servletResponse = $this->servletResponse;

            // load the session and the authentication manager
            $sessionManager = $application->search(SessionManagerInterface::IDENTIFIER);
            $authenticationManager = $application->search(AuthenticationManagerInterface::IDENTIFIER);

            // inject the sapplication and servlet response
            $servletRequest->injectContext($application);
            $servletRequest->injectResponse($servletResponse);
            $servletRequest->injectSessionManager($sessionManager);
            $servletRequest->injectAuthenticationManager($authenticationManager);

            // prepare the request instance
            $servletRequest->prepare();

            // initialize static request and application context
            RequestHandler::$requestContext = $servletRequest;
            RequestHandler::$applicationContext = $application;

            // add the application instance to the environment
            Environment::singleton()->setAttribute(EnvironmentKeys::APPLICATION, $application);

            // create a simulated request/session ID whereas session equals request ID (as long as session has NOT been started)
            Environment::singleton()->setAttribute(EnvironmentKeys::REQUEST_ID, $requestId = SessionUtils::generateRandomString());
            Environment::singleton()->setAttribute(EnvironmentKeys::SESSION_ID, $requestId);

            // process the valves
            foreach ($valves as $valve) {
                $valve->invoke($servletRequest, $servletResponse);
                if ($servletRequest->isDispatched() === true) {
                    break;
                }
            }

            // flush the session manager
            $sessionManager->flush();

            // profile the request if the profile logger is available
            if ($profileLogger = $application->getInitialContext()->getLogger(LoggerUtils::PROFILE)) {
                $profileLogger->appendThreadContext('request-handler');
                $profileLogger->debug($servletRequest->getUri());
            }

        } catch (\Exception $e) {
            $this->addError(ErrorUtil::singleton()->fromException($e));
        }

        // re-attach request and response instances
        $this->servletRequest = $servletRequest;
        $this->servletResponse = $servletResponse;
    }
1279745
private function startSession()
  {
    if (Config::has('session') && is_array($session = Config::get('session'))) {
      return session_start($session);
    }

    session_start([
      'name' => 'modulus_session'
    ]);
  }
1008806
protected function start()
    {
        // Configure name of session (this will replace the PHPSESSID identifier for cookie ...)
        session_name($this->getIdentifier());

        $sessionId = $this->getId();

        if (null !== $sessionId) {
            session_id($sessionId);
        }

        // set params for cookie!
        session_set_cookie_params(
            $this->getLifetime(),
            $this->retrievePathToCurrentClass(),
            $this->getDomain(),
            $this->getSsl(),
            $this->getHttpOnly()
        );

        $this->setStarted(session_start());

        if (null === $sessionId) {
            $sessionId = session_id();
            $this->setId($sessionId);
        }

        // Check stack for functions to execute
        $callStack = $this->callStack['start'];

        // Iterate over callstack
        foreach ($callStack as $call) {
            call_user_func([$call[0], $call[1]]);
        }

        // log created session-id and defined session parameter (cookie params)
        $this->getLogger()->debug(
            'session-id: '.$sessionId.' session-cookie-parameter: '.
            var_export(
                session_get_cookie_params(),
                true
            )
        );
    }
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));
    }
1019524
protected function _start()
	{
		// Start session if not started
		if ($this->state === 'restart')
		{
			session_regenerate_id(true);
		}
		else
		{
			$session_name = session_name();

			// Get the JInputCookie object
			$cookie = $this->input->cookie;

			if (is_null($cookie->get($session_name)))
			{
				$session_clean = $this->input->get($session_name, false, 'string');

				if ($session_clean)
				{
					session_id($session_clean);
					$cookie->set($session_name, '', time() - 3600);
				}
			}
		}

		/**
		 * Write and Close handlers are called after destructing objects since PHP 5.0.5.
		 * Thus destructors can use sessions but session handler can't use objects.
		 * So we are moving session closure before destructing objects.
		 *
		 * Replace with session_register_shutdown() when dropping compatibility with PHP 5.3
		 */
		register_shutdown_function('session_write_close');

		session_cache_limiter('none');
		session_start();

		return true;
	}
876548
public function start() {
		if($this->isStarted) {
			throw new \Exception(get_called_class() . ' is already started, use ' . get_called_class() . '::getInstance()->isStarted() to check it.');
		}
		$this->isStarted = true;

		if($this->handleErrors) {
			$this->initErrorsHandler();
		}
		if($this->handleExceptions) {
			$this->initExceptionsHandler();
		}
	}
217025
private function start()
    {
        # Starting session.
        # Here making session active to every request.
        new Session();

        $this->setBaseURL();
        $this->setRequestURI();
        $this->fetchRouteRules();
        $this->establishConnection();
        $this->locateMethod();
        $this->invokeMethod();
    }
29721
public function start()
    {
        if (headers_sent() === false) {
            session_start();
            $this->started = true;
            $this->session = &$_SESSION;

            return true;
        }

        return false;
    }
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();
        }
    }
987410
public function login() {
        if ($this->isLoggedIn()) {
            throw new BadMethodCallException('Client is already logged-in.');
        }

        // Auto-connect:
        if ($this->isConnected() === false) {
            $this->connect();
        }

        $response = $this->request(
            'idoit.login'
        );

        if (!array_key_exists('session-id', $response)) {
            throw new RuntimeException('Failed to login because i-doit responded without a session ID');
        }

        $this->session = $response['session-id'];

        return $this;
    }
1068065
public function start()
    {
        if ($this->isRunning()) {
            throw new LogicException('Process is already running');
        }

        $this->reset();

        $cmd = $this->cmd;
        if (substr($cmd, 0, 4) == 'php ') {
            $php = PHP_BINARY ?: PHP_BINDIR . '/php';
            $cmd = $php . substr($cmd, 3);
        }

        $descriptorspec = [
            0 => ['pipe', 'r'], // STDIN
            1 => ['pipe', 'w'], // STDOUT
            2 => ['pipe', 'w']  // STDERR
        ];

        $options = [
            'suppress_errors' => true,
            'binary_pipes'    => true,
        ];

        $this->process = proc_open($cmd, $descriptorspec, $this->pipes, base_path(), $this->env, $options);

        if (!is_resource($this->process)) {
            throw new RuntimeException('Unable to launch a new process.');
        }
    }
723315
protected function init()
	{
		if (isset($this->theme) === false)
		{
			throw new \RuntimeException('Theme property does not exist.');
		}

		if (empty($this->theme) === false and is_string($this->theme))
		{
			$this->theme = \Theme::instance($this->theme);
		}

		// Sets active theme
		if (empty($this->theme_active) === false and is_string($this->theme_active))
		{
			$this->theme->active($this->theme_active);
		}

		// Initialize template
		$this->template_init();

		$this->theme->set_template($this->template);

		// Makes the theme instance available in all views
		$this->template->set_global('theme', $this->theme, false);
	}
1121062
private function startSession()
    {
        if ('' === session_id()) {
            // no session active
            session_set_cookie_params(
                $this->sessionOptions['lifetime'],
                $this->sessionOptions['path'],
                $this->sessionOptions['domain'],
                $this->sessionOptions['secure'],
                $this->sessionOptions['httponly']
            );
            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;
        }
    }
372596
public function start()
    {
        $this->start   = microtime(true);
        $this->ip      = rcube_utils::remote_addr();
        $this->logging = $this->config->get('log_session', false);

        $lifetime = $this->config->get('session_lifetime', 1) * 60;
        $this->set_lifetime($lifetime);

        session_start();
    }