Read session data

@param string $id
191904
public function read($id)
    { 
		$res = $this->getDbConnection()->fetchColumn('SELECT value FROM session_data WHERE id=?',[$id],0);
		if (!$res) $res = '';
		return $res;
    }
1247523
public function read($id) {
        $tmp      = $_SESSION;
        $key      = $this->getKey($id);
        $_SESSION = json_decode($this->mem->get($key, false, ''), true);


        // TODO: replace all of this with custom session data modifiers to be executed one by one
        // TODO: Create CachedSessionHandler that accepts AbstractStorage as its storage
        // TODO: Refactor this to extend CachedSessionHandler and use JSON encode/decode where needed
        $user = $this->getUser();

        if ($user instanceof UserInterface) {
            $roles = array();
            /** @var RoleInterface $role */
            foreach ($user->getRoles() as $role) {
                $roles[] = $role->getRole();
            }
            $userData         = array(
                'username' => $user->getUsername(),
                'roles'    => $roles
            );
            $_SESSION['user'] = $userData;
        }

        if (isset($_SESSION) && !empty($_SESSION) && $_SESSION != null) {
            $new_data = session_encode();
            $_SESSION = $tmp;
            return $new_data;
        }
        return '';
    }
293796
public function read($session_id)
    {
        //string casting is a fix for PHP 7
        //when strict type are enable
        return (string) $this->pdo->queryWithParam(
            'SELECT session_data FROM session WHERE session_id = :session_id',
            [[':session_id', $session_id, \PDO::PARAM_STR]]
        )->fetchColumn();
    }
740526
public function read($session_id)
	{
		// Check if id exists
		if (!xcache_isset($this->key($session_id)))
		{
			return;
		}

		return (string) xcache_get($this->key($session_id));
	}
149821
public function read($id) {
    $crypto = $this->psl['crypt/crypto'];
    $store  = $this->psl['store'];

    /* If no cookie is set, just drop it! */
    if(!isset($_COOKIE[$this->name])) {
      return false;
    }

    /* Read from store and decrypt. */
    try {
      $sessData = $store->read('session', $_COOKIE[$this->name]);

      if($sessData !== false ) {
        $return = $crypto->decrypt($sessData, $this->secret);
      } else {
        $return = false;
      }
      return $return;
    }  catch (\phpSec\Exception $e) {
      return false;
    }
  }
250116
public function read($session_id)
	{
		$key = $this->key($session_id);

		$this->expiration($key);

		return $this->engine->get($key);
	}
1259854
protected function lock_session($id) {
        $lockkey = $id.".lock";

        $haslock = isset($this->locks[$id]) && $this->time() < $this->locks[$id];
        $startlocktime = $this->time();

        /* To be able to ensure sessions don't write out of order we must obtain an exclusive lock
         * on the session for the entire time it is open.  If another AJAX call, or page is using
         * the session then we just wait until it finishes before we can open the session.
         */
        while (!$haslock) {
            $haslock = $this->connection->setnx($lockkey, '1');
            if (!$haslock) {
                usleep(rand(100000, 1000000));
                if ($this->time() > $startlocktime + $this->acquiretimeout) {
                    // This is a fatal error, better inform users.
                    // It should not happen very often - all pages that need long time to execute
                    // should close session immediately after access control checks.
                    error_log('Cannot obtain session lock for sid: '.$id.' within '.$this->acquiretimeout.
                            '. It is likely another page has a long session lock, or the session lock was never released.');
                    throw new exception("Unable to obtain session lock");
                }
            } else {
                $this->locks[$id] = $this->time() + $this->lockexpire;
                $this->connection->expire($lockkey, $this->lockexpire);
                return true;
            }
        }
    }
310442
public function read( $id )
	{
	    if ( $this->has( $id ) )
		{
			return json_decode( \CCCrypter::decode( \CCCookie::get( $id.$this->cookie_suffix ), $this->crypt_salt ), true );
		}
		
		return array();
	}
385314
public function read($id)
    {
        try {
            $key = $this->datastore->key(
                $this->kind,
                $id,
                ['namespaceId' => $this->namespaceId]
            );
            $entity = $this->transaction->lookup($key);
            if ($entity !== null && isset($entity['data'])) {
                return $entity['data'];
            }
        } catch (Exception $e) {
            trigger_error(
                sprintf('Datastore lookup failed: %s', $e->getMessage()),
                E_USER_WARNING
            );
        }
        return '';
    }
924700
final public function read($id = Null)
    {

        $self = $this;

        $input = $this->input;
        $uri = $this->uri;
        //$dbo = Database::getInstance();

        $splash = $self->getSplash();

        //Do we have a cookie?
        $sessCookie = md5($self->cookie . $splash['agent'] . $splash['ip'] . $splash['domain']);

        $sessId = $input->getCookie($sessCookie);

        if (empty($sessId) || !$sessId) {
            //we will have to create a new session
            return false;
        }

        $userIp = md5($input->serialize($input->getVar('REMOTE_ADDR', \IS\STRING, '', 'server')));
        $userAgent = md5($input->serialize($input->getVar('HTTP_USER_AGENT', \IS\STRING, '', 'server')));
        $userDomain = md5($input->serialize((string)$uri->getHost()));

        //Read the session
        //$_handler = ucfirst($self->store);
        $handler = $this->handler;
        $object = $handler->read($splash, $self, $sessId);

        //If this is not an object then we have a problem
        if (!is_object($object)) return false;

        //Redecorate
        $splash = array(
            "ip" => $userIp,
            "agent" => $userAgent,
            "domain" => $userDomain,
            "token" => $object->session_token
        );

        $testId = $self->generateId($splash);

        if ($testId <> $sessId) {
            $this->destroy($sessId);
            return false; //will lead to re-creation
        }

        //check if expired
        $now = time();
        if ($object->session_expires < $now) {
            $this->destroy($sessId);
            return false; //Will lead to re-creation of a new one
        }

        $self->ip = $object->session_ip;
        $self->agent = $object->session_agent;
        $self->token = $object->session_token;
        $self->id = $sessId;

        //@TODO Restore the registry
        //which hopefully should contain auth and other serialized info in namespsaces
        $registry = new Registry("default");

        //Validate?
        if (!empty($object->session_registry)) {
            //First get an instance of the registry, just to be sure its loaded
            $registry = $input->unserialize($object->session_registry);
            $self->registry = $registry;
            $_SESSION = $self->getNamespace("default")->getAllData();
        } else {
            //just re-create a default registry
            $_SESSION = array(); //Session is array;
            //Because we can't restore
            $self->registry['default'] = $registry;
        }
        //Update total requests in the default namespace;
        $reqCount = $self->get("totalRequests");
        $newCount = $reqCount + 1;

        //Set a total Requests Count
        $self->set("totalRequests", $newCount);

        //Return the session Id, to pass to self::update
        return $sessId;
    }
229889
public function read(/*# string */ $session_id)/*# : string */
    {
        $file = $this->getSessionFile($session_id);
        $content = @file_get_contents($file);
        if (false === $content) {
            $content = 'a:0:{}';
        }
        return $content;
    }
788689
public function readSession($id)
    {
        $data = $this->cache->get($this->calculateKey($id));

        return $data === null ? '' : $data;
    }
234206
public function read($sessionId) {
        try {
            // try to retrieve the session content first to see if it exists
            $result = $this->_tableRestProxy->getEntity($this->_sessionContainer, $this->_sessionContainerPartition, $sessionId);
            // get the entity instance
            $entity = $result->getEntity();
            // deflat the serialized data
            return unserialize(base64_decode($entity->getPropertyValue('data')));
        } catch (ServiceException $e) {
            // the entity doesn't exist, return empty string according to the spec:
            //   http://www.php.net/manual/en/sessionhandlerinterface.read.php
            return '';
        }
    }
1013000
public function read(string $id) :? array
    {
        static $stmt;
        if (!isset($stmt)) {
            $stmt = $this->pdo->prepare("SELECT * FROM cesession_session WHERE id = :id");
        }
        $stmt->execute(compact('id'));
        if ($data = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            $this->exists = true;
            $data['data'] = base64_decode($data['data']);
            return $data;
        }
        $this->exists = false;
        return null;
    }
586119
public function sessionID($id = null)
    {
        $current = Arr::get($_COOKIE, HttpCache::$sessionName, '');

        if ($id === null)
        {
            return $current;
        }

        $this->setCookie(HttpCache::$sessionName, $id
            , ini_get('session.cookie_lifetime')
            , ini_get('session.cookie_path')
            , ini_get('session.cookie_domain')
            , ini_get('session.cookie_secure')
            , ini_get('session.cookie_httponly'));
        $_COOKIE[HttpCache::$sessionName] = $id;
        return $current;
    }
1224856
protected function updateSession($id)
    {
        $this->session->put($this->getName(), $id);
        $this->session->migrate(TRUE);
    }
629309
public function read($id)
    {
        $session = $this->entityManager->find($this->entityManager, $id);
        if (null !== $session) {
            if ($this->_getExpirationTime($session) > time()) {
                return $session->{$this->dataColumn};
            } else {
                $this->destroy($id);
            }
        }

        return '';
    }