/** * Write session data * * @param string $id * @param string $data * @return bool|int */ public function write($id, $data) { $return = false; if (!$id) { return $return; } $row = $this->row && $id == $this->row->id ? $this->row : $this->model->find($id); $data = array('modified' => time(), 'data' => (string) $data); if (null !== $this->uid) { $data['uid'] = (int) $this->uid; } try { if ($row) { $row->assign($data); $return = $row->save(false); } else { $data['id'] = $id; $data['lifetime'] = $this->lifetime; $row = $this->model->createRow($data); $return = $row->save(false); } } catch (\Exception $e) { trigger_error('Session write error: ' . $e->getMessage(), E_USER_ERROR); } return $return; }