Ejemplo n.º 1
0
 /**
  * handleSessionStartError() - interface for set_error_handler()
  *
  * @see    http://framework.zend.com/issues/browse/ZF-1325
  * @param  int    $errno
  * @param  string $errstr
  * @return void
  */
 public static function handleSessionStartError($errno, $errstr, $errfile, $errline, $errcontext)
 {
     self::$sessionStartError = $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr . ' ' . $errcontext;
 }
Ejemplo n.º 2
0
 /**
  * Read session data
  *
  * @param string $id
  */
 public function read($id)
 {
     // The mongo backend might produce some error if the servers are unavailable
     // for example.
     $oldStartError = Zend_Session_Exception::$sessionStartError;
     try {
         // Fetch the contents from mongo
         $session = $this->_collection->findOne(array('_id' => $id, 'metadata.expire' => array('$gt' => new MongoDate(time()))));
         if (!$session || !isset($session['data']) || !isset($session['metadata']) || !isset($session['metadata']['expire'])) {
             $session = '';
             unset($this->_sessionHashes[$id]);
         } else {
             $session = $session['data'];
             $this->_sessionHashes[$id] = md5($session);
         }
         // Restore the previous error (if any)
         Zend_Session_Exception::$sessionStartError = $oldStartError;
         return $session;
     } catch (\Exception $e) {
         \App::log()->crit($e);
     }
     return '';
 }
Ejemplo n.º 3
0
 /**
  * handleSessionStartError() - interface for set_error_handler()
  *
  * @see    http://framework.zend.com/issues/browse/ZF-1325
  * @param  int    $errno
  * @param  string $errstr
  * @return void
  */
 public static function handleSessionStartError($errno, $errstr)
 {
     self::$sessionStartError = $errstr;
 }
Ejemplo n.º 4
0
 /**
  * Read session data
  *
  * @param string $id
  */
 public function read($id)
 {
     // The cache backend might produce some error if the servers are unavailable
     // for example.
     $oldStartError = Zend_Session_Exception::$sessionStartError;
     // Fetch the contents from the cache
     $session = $this->_cache->load($this->_prefix . $id);
     if (!$session) {
         $session = '';
     }
     // Restore the previous error (if any)
     Zend_Session_Exception::$sessionStartError = $oldStartError;
     return $session;
 }