Get curren session handler

@since 4.4
@return ezpSessionHandler
197374
static public function getHandlerInstance( ezpSessionHandler $handler = null )
    {
        if ( self::$handlerInstance === null )
        {
            if ( $handler === null )
            {
                $ini = eZINI::instance();
                if ( $ini->variable( 'Session', 'Handler' ) !== '' )
                {
                    $optionArray = array(
                        'iniFile'       => 'site.ini',
                        'iniSection'    => 'Session',
                        'iniVariable'   => 'Handler',
                        'handlerParams' => array( self::$hasSessionCookie )
                    );

                    $options = new ezpExtensionOptions( $optionArray );
                    self::$handlerInstance = eZExtension::getHandlerClass( $options );
                }
            }
            else
            {
                self::$handlerInstance = $handler;
            }
            if ( !self::$handlerInstance instanceof ezpSessionHandler )
            {
                self::$handlerInstance = new ezpSessionHandlerPHP( self::$hasSessionCookie );
            }
        }
        return self::$handlerInstance;
    }
163327
function getUserFromPHPSession() {
		if ($this->user == null) {
            $sid = $this->request->session('usersid', '');
            if ($sid == '') {
                // try with a get key
                $sid = $this->request->get('sessionid', '');
            }
			$this->user = $this->getUserFromSession($sid);
		}
        return $this->user;
    }
1268539
public function getCurrentSession()
    {
        if (is_null($this->currentSession)) {
            $this->currentSession = $this->mapper->mapFromStorage(
                $this->request($this->buildUrl(new CurrentSession()), 'GET')
            );
        }
        if (!($this->currentSession instanceof CurrentSession)) {
            $this->currentSession = null;
            throw new NotLoggedInException('Authorization required');
        }
        return $this->currentSession;
    }
405289
public static function get_exception_handler() {
        return function($ex) {
            $info = get_exception_info($ex);

            $logerrmsg = "enrol_paypal IPN exception handler: ".$info->message;
            if (debugging('', DEBUG_NORMAL)) {
                $logerrmsg .= ' Debug: '.$info->debuginfo."\n".format_backtrace($info->backtrace, true);
            }
            error_log($logerrmsg);

            if (http_response_code() == 200) {
                http_response_code(500);
            }

            exit(0);
        };
    }
600633
public function getMessageHandler()
    {
        if (null !== $this->messageHandler) {
            return $this->messageHandler;
        }

        return $this->messageHandler = new MessageHandler($this);
    }
556292
public static function getHandle()
    {
        if (!isset(self::$_dbhnd)) {
            self::$_dbhnd = new \PDO(
                BLConfig::get('db', 'dsn'),
                BLConfig::get('db', 'user'),
                BLConfig::get('db', 'pass')
            );
            self::$_dbhnd->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
        }
        return self::$_dbhnd;
    }
866239
public function getSessionClient()
    {
        if (is_null($this->sessionClient)) {
            $this->sessionClient = Client::makeGuzzle($this->sessionEndpoint);
        }

        return $this->sessionClient;
    }
81931
private function sessionHandler()
    {
        if (PHP_SAPI == 'cli') {
            return;
        }
        $sessionConfig = $this->getConfigVar('session');

        if (!empty($sessionConfig['no_session_cmd']) && !in_array($this->cmd, $sessionConfig['no_session_cmd'])) {
            if (preg_match('/([^.]+)\.(\D+)$/sim', $_SERVER['HTTP_HOST'], $regs)) {
                $arr = explode('.', $_SERVER['HTTP_HOST']);
                $cookieDomain = '.' . $arr[count($arr) - 2] . '.' . $arr[count($arr) - 1];
            } else {
                $cookieDomain = $_SERVER['HTTP_HOST'];
            }

            ini_set('session.cookieDomain', $cookieDomain);
            if (isset($sessionConfig['session.cache_expire'])) {
                ini_set('session.cache_expire', $sessionConfig['session.cache_expire']);
            }

            if (isset($sessionConfig['session.gc_maxlifetime'])) {
                ini_set('session.gc_maxlifetime', $sessionConfig['session.gc_maxlifetime']);
            }

            if (isset($sessionConfig['session.cookie_lifetime'])) {
                ini_set('session.cookie_lifetime', $sessionConfig['session.cookie_lifetime']);
            }

            if (!empty($sessionConfig['session.save_path'])) {
                ini_set('session.save_path', $sessionConfig['session.save_path']);
            }

            if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
                session_id($_GET['session_id']);
            }

            @session_start();
            $this->sessionStarted = true;
        }
    }
577847
public function doShow()
    {
        if ( ($this->exception instanceof ezcMvcRouteNotFoundException) || ($this->exception instanceof ezpContentNotFoundException ) )
        {
            // we want to return a 404 to the user
            $result = new ezcMvcResult;
            $result->status = new ezpRestHttpResponse( ezpHttpResponseCodes::NOT_FOUND, "Not Found" );
            return $result;
        }

        else if ( $this->exception instanceof ezpOauthBadRequestException )
        {
            $result = new ezcMvcResult;
            $result->status = new ezpRestOauthErrorStatus( $this->exception->errorType, $this->exception->getMessage() );
            $result->variables['message'] = $this->exception->getMessage();
            return $result;
        }
        else if ( $this->exception instanceof ezpOauthRequiredException )
        {
            $result = new ezcMvcResult;
            $result->status = new ezpOauthRequired( "eZ Publish REST", $this->exception->errorType, $this->exception->getMessage() );
            $result->variables['message'] = $this->exception->getMessage();
            return $result;
        }
        else if ( $this->exception instanceof ezpContentAccessDeniedException )
        {
            $result = new ezcMvcResult;
            $result->variables['message'] = $this->exception->getMessage();
            $result->status = new ezpRestHttpResponse( ezpHttpResponseCodes::FORBIDDEN, $this->exception->getMessage() );
            return $result;
        }
        else if ( $this->exception instanceof ezpRouteMethodNotAllowedException )
        {
            $result = new ezpRestMvcResult;
            $result->status = new ezpRestStatusResponse(
                ezpHttpResponseCodes::METHOD_NOT_ALLOWED,
                $this->exception->getMessage(),
                array( 'Allow' => implode( ', ', $this->exception->getAllowedMethods() ) )
            );
            return $result;
        }

        $result = new ezcMvcResult;
        $result->variables['message'] = $this->exception->getMessage();
        $result->status = new ezpRestHttpResponse( ezpHttpResponseCodes::SERVER_ERROR, $this->exception->getMessage() );
        return $result;
    }
820874
public function getExceptionHandler() : ExceptionHandlerInterface
    {
        if (!$this->exceptionHandler) {
            $this->exceptionHandler = new ExceptionHandler(
                (bool) $this->getConfiguration('displayErrors')
            );
        }

        return $this->exceptionHandler;
    }
779621
protected function getViewHandler()
    {
        if (!$this->viewhandler instanceof ViewHandlerInterface) {
            $this->viewhandler = $this->container->get('fos_rest.view_handler');
        }

        return $this->viewhandler;
    }
150804
public function onSessionReadEvent()
    {
        return function ($sessionEvent) {
            /** @var \PHPDaemon\Core\DeferredEvent $sessionEvent */
            $name = ini_get('session.name');
            $sid = $this->getCookieStr($name);
            if ($sid === '') {
                $sessionEvent->setResult(false);
                return;
            }
            if ($this->getSessionState() !== null) {
                $sessionEvent->setResult(true);
                return;
            }
            $this->sessionRead($sid, function ($data) use ($sessionEvent, $sid) {
                $canDecode = $data !== false && $this->sessionDecode($data);
                $sessionEvent->setResult($canDecode);
            });
        };
    }
1107919
public function getSession()
    {
        if (self::$_oSession == null) {
            self::$_oSession = \OxidEsales\Eshop\Core\Registry::getSession();
        }

        return self::$_oSession;
    }
635161
public static function getDefaultHandler()
    {
        $default = $future = null;

        if (extension_loaded('curl')) {
            $config = [
                'select_timeout' => getenv('GUZZLE_CURL_SELECT_TIMEOUT') ?: 1
            ];
            if ($maxHandles = getenv('GUZZLE_CURL_MAX_HANDLES')) {
                $config['max_handles'] = $maxHandles;
            }
            if (function_exists('curl_reset')) {
                $default = new CurlHandler();
                $future = new CurlMultiHandler($config);
            } else {
                $default = new CurlMultiHandler($config);
            }
        }

        if (ini_get('allow_url_fopen')) {
            $default = !$default
                ? new StreamHandler()
                : Middleware::wrapStreaming($default, new StreamHandler());
        } elseif (!$default) {
            throw new \RuntimeException('Guzzle requires cURL, the '
                . 'allow_url_fopen ini setting, or a custom HTTP handler.');
        }

        return $future ? Middleware::wrapFuture($default, $future) : $default;
    }
9891
public function getHandle()
    {
        if (isset($this->_identity_key)) {
            $handle = $this->getProperty($this->_identity_key);
        } else {
            $handle = parent::getHandle();
        }

        return $handle;
    }
302180
public function get_handler() : handler {
        if ($this->handler === null) {
            $this->handler = handler::get_handler($this->get('component'), $this->get('area'), $this->get('itemid'));
        }
        return $this->handler;
    }
241597
protected function getSession()
    {
        if ($this->session === null) {
            $this->session = $this
                ->getPomm()
                ->getSession($this->config_name)
                ->registerClientPooler(new InspectorPooler())
                ;
        }

        return $this->session;
    }