protected function write() { $data = $this->serializer->serialize($this->data); if ($this->options->getBoolean('lazy_write', false) && $this->handler instanceof LazyWriteHandlerInterface && md5($data) === $this->dataHash) { $this->handler->updateTimestamp($this->id, $data); } else { $this->handler->write($this->id, $data); } }
protected function initializeSession() { $this->handler->open(null, $this->id); $data = $this->handler->read($this->id); try { $this->data = $this->serializer->unserialize($data); } catch (\Exception $e) { // Destroy data upon unserialization error $this->handler->destroy($this->id); } }