Starts a session

@param type $killPrevious
@return void
490634
final public function start($killPrevious = FALSE)
    {

        //starts this session if not creates a new one
        //$self = (!isset($this) || !is_a($this, "Library\Session")) ? self::getInstance() : $this;
        //@TODO Check if there is an existing session!
        //If there is any previous and killprevious is false,
        //simply do a garbage collection and return;
        //if we can't read the session
        if (($session = $this->read()) !== FALSE) {
            $this->update($session);
        } else {
            $this->create();
        }
        //Carbage collection
        $this->gc();
    }
535619
protected function beforeStart()
    {
        // If no explicit request was given (via Enlighten::setRequest), create one based on the current PHP globals
        if (empty($this->request)) {
            $this->setRequest(Request::extractFromEnvironment());
        }

        $this->bootstrapRouter();
    }
1070112
public function startSession()
    {
        return (string) $this->sendTransaction([
          'email' => $this->email,
          'token' => $this->token,
        ], $this->url['session'])->id;
    }
1218427
public function start()
    {
        if (!session_id() || !$this->isActive()) {
            $file = $line = null;
            if (headers_sent($file, $line)) {
                throw new \RuntimeException(sprintf('Unable to start session, output started at %s:%s', $file, $line));
            }
            session_start();
        }

        if ($this->namespace) {
            if (!isset($_SESSION[$this->namespace])) {
                $_SESSION[$this->namespace] = array();
            }
            $this->data = &$_SESSION[$this->namespace];
        } else {
            $this->data = &$_SESSION;
        }
    }
234919
protected function sessionStart($force_start = true)
    {
        if ($this->sessionStarted) {
            return;
        }
        $this->sessionStarted = true;
        if (!$this instanceof \PHPDaemon\HTTPRequest\Generic) {
            Daemon::log('Called ' . get_class($this) . '(trait \PHPDaemon\Traits\Sessions)->sessionStart() outside of Request. You should use onSessionStart.');
            return;
        }
        $f = true; // hack to avoid a sort of "race condition"
        $this->onSessionStart(function ($event) use (&$f) {
            $f = false;
            $this->wakeup();
        });
        if ($f) {
            $this->sleep($this->sessionStartTimeout);
        }
    }
855253
public static function initialize( $startSession = true )
    {
        \ini_set( 'session.gc_maxlifetime', self::SessionCookieGcTimeout + self::SessionCookieLifetime );
        \session_set_cookie_params( self::SessionCookieLifetime, self::SessionCookiePath );
        \session_start();

        //	Ensure we can write by registering a shutdown function
        \register_shutdown_function( 'session_write_close' );
    }
323119
public function startMinkSession($driver = '')
    {
        $this->stopMinkSession();
        $this->currentMinkDriver = $driver ? $driver : $this->currentMinkDriver;

        $driverInterface = $this->_getMinkDriver($this->currentMinkDriver);
        self::$minkSession = new \Behat\Mink\Session($driverInterface);
        self::$minkSession->start();
    }
224494
public function start(): void
    {
        if (\session_status() !== PHP_SESSION_ACTIVE) {

            //prepare the session start
            \session_name($this->name);

            //start session
            \session_start([
                'cookie_path'      => $this->cookiePath,
                'cookie_domain'    => $this->cookieDomain,
                'cookie_lifetime'  => $this->expire,
                'cookie_secure'    => $this->cookieSecure,
                'cookie_httponly'  => $this->cookieHttpOnly
            ]);

            //link session super global to $data property
            $this->data = &$_SESSION;
        }

        //refresh session
        $this->refresh();
    }
571494
public function startSession($domain) {
        $this->cookieLocation = str_replace('APP_ROOT', APP_ROOT, $this->cookieLocation);
        if (!is_dir($this->cookieLocation))
            mkdir($this->cookieLocation);
        if (!is_dir($this->cookieLocation)) {
            $this->error($this->error = "Can't create folder {$this->cookieLocation}");
        }
        $this->currentFile = $this->cookieLocation . date('YmdHis') . '-' . md5($domain);
        fclose(fopen($this->currentFile, 'w'));
    }
9795
public function onSessionStartEvent()
    {
        return function ($sessionStartEvent) {
            /** @var \PHPDaemon\Core\DeferredEvent $sessionStartEvent */
            $name = ini_get('session.name');
            $sid = $this->getCookieStr($name);
            if ($sid === '') {
                $this->sessionStartNew(function ($success) use ($sessionStartEvent) {
                    $sessionStartEvent->setResult($success);
                });
                return;
            }
            $this->onSessionRead(function ($session) use ($sessionStartEvent) {
                if ($this->getSessionState() === null) {
                    $this->sessionStartNew(function ($success) use ($sessionStartEvent) {
                        $sessionStartEvent->setResult($success);
                    });
                    return;
                }
                $sessionStartEvent->setResult(true);
            });
        };
    }
877825
public function start()
    {
        if (!$this->active()) {
            session_start();
            $this->session =& $_SESSION;
        } elseif (!isset($this->session)) {
            $this->session =& $_SESSION;
        }
    }
528656
public function call()
    {
        $defaultOptions = array(
            'name' => 'BSESS',
            'lifetime' => 0,
            'path' => \URL::base('', false),
            'domain' => '',
            'secure' => false,
            'httpOnly' => false,
        );

        if (is_array($this->options)) {
            $this->options = array_merge($defaultOptions, $this->options);
        } else {
            $this->options = $defaultOptions;
        }
        $this->app->session = $this;

        if (!$this->app->config('session.preventSession')) {
            $this->start();
        }

        $this->next->call();
    }
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');
        }
    }
285636
public static function start($name = null) {
		if (! self::isStarted ()) {
			if (isset ( $name ) && $name !== "") {
				self::$name = $name;
			}
			if (isset ( self::$name )) {
				\session_name ( self::$name );
			}
			\session_start ();
		}
	}
450327
public function runBefore() {
        if($this->_beforeController !== null) {
            foreach($this->_beforeController as $hookProvider) {
                $hookProvider->doBefore();
            }
        }
    }
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);
            }
        }
    }
420642
public function start()
    {

        // we need the session to be started
        if ($this->isStarted()) {
            return;
        }

        // create a new cookie with the session values
        $cookie = new HttpCookie(
            $this->getName(),
            $this->getId(),
            $this->getLifetime(),
            $this->getMaximumAge(),
            $this->getDomain(),
            $this->getPath(),
            $this->isSecure(),
            $this->isHttpOnly()
        );

        // start the session and set the started flag
        $this->getSession()->start();

        // add the cookie to the response
        $this->getRequest()->setRequestedSessionId($this->getId());
        $this->getResponse()->addCookie($cookie);
    }