Ejemplo n.º 1
0
 function testSave()
 {
     AbstractSession::destroySafely();
     call_user_func($this->handler . '::init', $this->wrapper);
     $_SESSION['foo'] = 'bar';
     $id = session_id();
     session_write_close();
     $sessFetched = $this->wrapper->get($this->prefix . $id);
     $this->assertNotEmpty($sessFetched, _unit_dump(['id' => $id, 'fetched' => $sessFetched, 'all' => $this->wrapper->getAll(), 'is_available' => $this->wrapper->isAvailable()]));
     $this->assertTrue(stripos($sessFetched, 'foo') !== false, '"foo" not found in session data');
     $this->assertTrue(stripos($sessFetched, 'bar') !== false, '"bar" not found in session data');
 }
Ejemplo n.º 2
0
 /**
  * Write session data
  *
  * @author Art <*****@*****.**>
  * @link   http://php.net/manual/en/sessionhandlerinterface.write.php
  *
  * @param string $sessionID    The session id.
  * @param string $sessionData  The encoded session data. This data is the
  *                             result of the PHP internally encoding
  *                             the $_SESSION superglobal to a serialized
  *                             string and passing it as this parameter.
  *                             Please note sessions use an alternative serialization method.
  *
  * @return bool
  */
 public function write($sessionID, $sessionData)
 {
     return $this->db->prepQuery('INSERT INTO `' . ALO_SESSION_TABLE_NAME . '`(' . '`id`,' . '`data`,' . '`access`) VALUES(:id,:data,CURRENT_TIMESTAMP) ' . 'ON DUPLICATE KEY UPDATE ' . '`data`=VALUES(`data`),' . '`access`=CURRENT_TIMESTAMP', [':id' => $sessionID, ':data' => $sessionData]);
 }