src/Session/Session.php
public function start(array $options = null)
    {
        $sessionStatus = \session_status();

        if ($sessionStatus === PHP_SESSION_DISABLED) {
            throw new \RuntimeException('PHP sessions are disabled');
        }

        if ($sessionStatus === PHP_SESSION_ACTIVE) {
            throw new \RuntimeException('session has already been started');
        }

        if ($this->handler) {
            \session_set_save_handler($this->handler, true);
        }

        \session_set_cookie_params(
            $this->cookieParams['lifetime'],
            $this->cookieParams['path'],
            $this->cookieParams['domain'],
            $this->cookieParams['secure'],
            $this->cookieParams['httponly']
        );

        if ($options === null) {
            $options = [];
        }

        if (!isset($options['serialize_handler'])) {
            $serializeHandler = \ini_get('serialize_handler');
            if ($serializeHandler === 'php' || $serializeHandler === 'php_binary') {
                $options['serialize_handler'] = 'php_serialize';
            }
        }

        $result = \session_start($options);

        if ($result) {
            $this->moveFlash();
        }

        return $result;
    }
public function start(array $options = null)
    {
        $sessionStatus = \session_status();

        if ($sessionStatus === PHP_SESSION_DISABLED) {
            throw new \RuntimeException('PHP sessions are disabled');
        }

        if ($sessionStatus === PHP_SESSION_ACTIVE) {
            throw new \RuntimeException('session has already been started');
        }

        if ($this->handler) {
            \session_set_save_handler($this->handler, true);
        }

        \session_set_cookie_params(
            $this->cookieParams['lifetime'],
            $this->cookieParams['path'],
            $this->cookieParams['domain'],
            $this->cookieParams['secure'],
            $this->cookieParams['httponly']
        );

        if ($options === null) {
            $options = [];
        }

        if (!isset($options['serialize_handler'])) {
            $serializeHandler = \ini_get('serialize_handler');
            if ($serializeHandler === 'php' || $serializeHandler === 'php_binary') {
                $options['serialize_handler'] = 'php_serialize';
            }
        }

        $result = \session_start($options);

        if ($result) {
            $this->moveFlash();
        }

        return $result;
    }
public function start ( array $ options = null ) { $ sessionStatus = \ session_status ( ) ; if ( $ sessionStatus === PHP_SESSION_DISABLED ) { throw new \ RuntimeException ( 'PHP sessions are disabled' ) ; } if ( $ sessionStatus === PHP_SESSION_ACTIVE ) { throw new \ RuntimeException ( 'session has already been started' ) ; } if ( $ this -> handler ) { \ session_set_save_handler ( $ this -> handler , true ) ; } \ session_set_cookie_params ( $ this -> cookieParams [ 'lifetime' ] , $ this -> cookieParams [ 'path' ] , $ this -> cookieParams [ 'domain' ] , $ this -> cookieParams [ 'secure' ] , $ this -> cookieParams [ 'httponly' ] ) ; if ( $ options === null ) { $ options = [ ] ; } if ( ! isset ( $ options [ 'serialize_handler' ] ) ) { $ serializeHandler = \ ini_get ( 'serialize_handler' ) ; if ( $ serializeHandler === 'php' || $ serializeHandler === 'php_binary' ) { $ options [ 'serialize_handler' ] = 'php_serialize' ; } } $ result = \ session_start ( $ options ) ; if ( $ result ) { $ this -> moveFlash ( ) ; } return $ result ; }
Starts a new or existing session.

@param array $options

@return bool

@throws \RuntimeException
Starts a new or existing session .