Mage_Core_Model_Resource_Session::read PHP Method

read() public method

(Fix for PHP 7 to make sure it really returns string type as docblock promises, because otherwise session crashes.)
public read ( string $sessId ) : string
$sessId string
return string
    public function read($sessId)
    {
        $select = $this->_read->select()->from($this->_sessionTable, array('session_data'))->where('session_id = :session_id')->where('session_expires > :session_expires');
        $bind = array('session_id' => $sessId, 'session_expires' => Varien_Date::toTimestamp(true));
        $data = $this->_read->fetchOne($select, $bind);
        return (string) $data;
    }

Usage Example

Exemplo n.º 1
0
 public function testGc()
 {
     $this->_model->write('test', 'test');
     $this->assertEquals('test', $this->_model->read('test'));
     $this->_model->gc(-1);
     $this->assertEmpty($this->_model->read('test'));
 }
All Usage Examples Of Mage_Core_Model_Resource_Session::read