Example #1
0
 /**
  * Destructor for this class. It will save the session to the session handler
  * in case the session has been marked as dirty. Do nothing otherwise.
  */
 public function __destruct()
 {
     if (!$this->dirty) {
         /* Session hasn't changed - don't bother saving it. */
         return;
     }
     $this->dirty = FALSE;
     $sh = SimpleSAML_SessionHandler::getSessionHandler();
     try {
         $sh->saveSession($this);
     } catch (Exception $e) {
         if (!$e instanceof SimpleSAML_Error_Exception) {
             $e = new SimpleSAML_Error_UnserializableException($e);
         }
         SimpleSAML_Logger::error('Unable to save session.');
         $e->logError();
     }
 }
Example #2
0
 /**
  * Save the session to the store.
  *
  * This method saves the session to the session handler in case it has been marked as dirty.
  *
  * WARNING: please do not use this method directly unless you really need to and know what you are doing. Use
  * markDirty() instead.
  */
 public function save()
 {
     if (!$this->dirty) {
         // session hasn't changed, don't bother saving it
         return;
     }
     $this->dirty = false;
     $this->callback_registered = false;
     $sh = SimpleSAML_SessionHandler::getSessionHandler();
     try {
         $sh->saveSession($this);
     } catch (Exception $e) {
         if (!$e instanceof SimpleSAML_Error_Exception) {
             $e = new SimpleSAML_Error_UnserializableException($e);
         }
         SimpleSAML\Logger::error('Unable to save session.');
         $e->logError();
     }
 }