Esempio n. 1
0
 /**
  * Restores variable space from current snapshot made to be storable in
  * session.
  */
 protected final function makeUsable()
 {
     if (trim($this->storable)) {
         if (data::autoType(config::get('session.encrypt', false), 'boolean')) {
             try {
                 $space = unserialize(crypt::create()->decrypt($this->storable));
             } catch (\InvalidArgumentException $e) {
                 log::warning('session lost due to failed decryption, might be okay if browser lost cookie in between');
                 $space = array();
             }
         } else {
             $space = unserialize($this->storable);
         }
         if (is_array($space)) {
             $this->usable = $space;
         }
         $this->storable = null;
     }
     if (!is_array($this->usable)) {
         $this->usable = array();
     }
 }