Read session file

@return void
324932
private function read()
    {
        $this->lock();

        $data = '';

        rewind($this->handle);

        $data = trim(stream_get_contents($this->handle));

        if ($data !== '') {
            $this->data = unserialize($data);
            $data = null;
        }

        flock($this->handle, LOCK_UN);

        $this->iterator = new \ArrayIterator($this->data);
    }
692934
protected function read()
	{
		if( $this->useCache )
		{
			$fileName	= $this->pathCache.basename( $this->fileName ).".cache";
			if( file_exists( $fileName ) && file_exists( $this->fileName ) && filemtime( $fileName ) == filemtime( $this->pathConfig.$this->fileName ) )
			{
				return $this->readCache( $fileName );
			}
			else
			{
				$this->readWDDX();
				return $this->writeCache( $fileName );
			}
		}
		return $this->readWDDX();

	}
1203036
protected function readFromTempFile()
    {
        // Upload temp file
        $sUploadTempFile = $this->getUploadTempFile();
        $aFiles = json_decode(file_get_contents($sUploadTempFile), true);
        foreach($aFiles as $sVarName => $aUserFiles)
        {
            $this->aUserFiles[$sVarName] = [];
            foreach($aUserFiles as $aUserFile)
            {
                $this->aUserFiles[$sVarName][] = UploadedFile::fromTempData($aUserFile);
            }
        }
        unlink($sUploadTempFile);
    }
45695
def load_session_from_file(self, username: str, filename: Optional[str] = None) -> None:
        
        if filename is None:
            filename = get_default_session_filename(username)
        with open(filename, 'rb') as sessionfile:
            self.context.load_session_from_file(username, sessionfile)
            self.context.log("Loaded session from %s." % filename)
820856
public function read($session_id)
    {
        $result = '';

        if ($this->getTable()->isConnected())
        {
            $row = $this->_table->select($session_id, KDatabase::FETCH_ROW);

            if (!$row->isNew()) {
                $result = $row->data;
            }
        }

        /*
         * It turns out that session_start() doesn't like the read method of a custom session handler
         * returning false or null if there's no session in existence.
         *
         * See: https://stackoverflow.com/a/48245947
         * See: http://php.net/manual/en/function.session-start.php#120589
         */
        return $result !== null ? $result : '';

    }
1361973
public function do_read($session_id)
    {
        $file = $this->_getFileName($session_id);

        if (file_exists($file) && filemtime($file) >= time()) {
            return file_get_contents($file);
        } else {
            return '';
        }
    }
15891
private function loadFromFile(SessionInterface $session)
    {
        $id = preg_replace('/[^\w\-]+/', '-', $session->getId());
        $dir = (new Config())->getSessionDir();
        $filename = "$dir/sess-$id/sess-$id.json";
        if (is_readable($filename) && ($contents = file_get_contents($filename))) {
            $data = json_decode($contents, true) ?: [];
            $session->setData($data);
            $this->save($session);
            // Reload the session from the keychain, and delete the file if
            // successful.
            if (rename($filename, $filename . '.bak')) {
                $this->load($session);
                if ($session->getData()) {
                    unlink($filename . '.bak');
                }
            }
        }
    }
377079
private function read()
    {
        // Fetch session cookie
        $sessionId = isset($_COOKIE[$this->cookieName]) ? $_COOKIE[$this->cookieName] : false;

        // Cookie does not exist
        if (!$sessionId) {
            return false;
        }

        $this->sessionId = $sessionId;

        // Fetch the session from the database
        $stmt = $this->db->prepare("SELECT data, user_agent, ip_address, time_updated FROM {$this->tableName} WHERE session_id = ?");
        $stmt->execute([$this->sessionId]);

        $result = $stmt->fetch(PDO::FETCH_ASSOC);

        // Run validations if a session exists
        if ($result !== false && !empty($result)) {
            // Check if the session has expired in the database
            if ($this->expireOnClose === false && ($result['time_updated'] + $this->secondsUntilExpiration) < $this->now) {
                $this->destroy();
                return false;
            }

            // Check if the IP address matches the one saved in the database
            if ($this->checkIpAddress === true && $result['ip_address'] !== $this->ipAddress) {
                $this->destroy();
                return false;
            }

            // Check if the user agent matches the one saved in the database
            if ($this->checkUserAgent === true && $result['user_agent'] !== $this->userAgent) {
                $this->destroy();
                return false;
            }

            // Is it time to regenerate the session ID?
            if (($result['time_updated'] + $this->renewalTime) < $this->now) {
                $this->regenerateId();
            }

            // Make stored user data available
            if ($sessionData = json_decode($result['data'], true)) {
                $this->data = isset($sessionData['data']) ? $sessionData['data'] : [];
                $this->lastFlashData = isset($sessionData['flash']) ? $sessionData['flash'] : [];

                unset($sessionData);
            }

            // We have a valid session
            return true;
        }

        // No session found
        return false;
    }
977048
public function read()
    {
        $path = $this->getProjectPath() . '/' . $this->getOutputFile();
        if (!is_readable($path)) {
            $this->getContainer()->setValues(null);
            return $this->getContainer();
        }
        $newContainer = unserialize(file_get_contents($path));
        return $newContainer;
    }
597977
public function read($session_id)
    {
        $session = $this->sessions()
            ->where('id', $session_id)->first();

        if (is_null($session)) {
            return '';
        }

        return $session->data;
    }
952633
private static function read()
	{
		self::lock();
		if ( is_null( self::$authFileP ) ) throw new Exception( 'No lock has been requested' );
		return stream_get_contents( self::$authFileP , -1 , 0 );
	}
1328865
public function read(string $sessionId)
    {
        $file = "{$this->savePath}/{$this->sessionName}_{$sessionId}";
        if (!is_file($file)) {
            return false;
        }

        return $this->getObject(\PG\MSF\Coroutine\File::class)->goReadFile($file);
    }
253983
public function read()
	{
		// do we need to create a new session?
		empty($this->keys) and $this->create();

		// mark the loaded flash data, auto-expire if configured
		foreach($this->flash as $key => $value)
		{
			if ($this->config['flash_auto_expire'] === true)
			{
				$this->flash[$key]['state'] = 'expire';
			}
			else
			{
				$this->flash[$key]['state'] = 'loaded';
			}
		}

		return $this;
	}
19992
protected function loadSession()
    {
        if (session_id() === '') {
            session_start();
        }

        $value = \Slim\Http\Util::decodeSecureCookie(
            $this->app->request()->cookies($this->settings['name']),
            $this->settings['secret'],
            $this->settings['cipher'],
            $this->settings['cipher_mode']
        );
        if ($value) {
            $_SESSION = unserialize($value);
        } else {
            $_SESSION = array();
        }
    }
524008
protected function getFileContents()
    {
        $json = file_get_contents( $this->sessionPath );

        $this->items = json_decode( $json, TRUE );
    }
1224273
private static function session($session)
    {
        $files = ['Session'];
        $folder = static::$root.'Storage'.'/';

        self::call($files, $folder);

        $files = ['SessionKeyNotFoundException', 'SessionSurfaceIsOffException'];
        $folder = static::$root.'Storage/Exceptions'.'/';

        self::call($files, $folder);

        //Initiat the class
        if ($session) {
            Session::ini();
        }
    }
390915
public function read($session_id)
	{
		// get session hash
		$session = $this->database->hgetall($this->key($session_id));

		// return session data
		return (isset($session['data'])) ? $session['data'] : null;
	}