diff --git a/website/app/GeoKrety/Session.php b/website/app/GeoKrety/Session.php index 5af525ab3b..ff0a205dc8 100644 --- a/website/app/GeoKrety/Session.php +++ b/website/app/GeoKrety/Session.php @@ -55,7 +55,11 @@ public function write($id, $data) { $this->set('ip', $this->_ip); $this->set('agent', $this->_agent); $this->set('stamp', time() + $session_lifetime); - $this->save(); + if ($this->dry()) { + $this->insert(); + } else { + $this->update(); + } return true; } diff --git a/website/init-f3.php b/website/init-f3.php index dbdb9584b4..c21589f76b 100644 --- a/website/init-f3.php +++ b/website/init-f3.php @@ -131,13 +131,13 @@ $f3->reroute($f3->get('ERROR_REDIRECT') ?: '@home'); } if ($error['code'] === 500 && !GK_DEBUG) { - \Sentry\withScope(function (Sentry\State\Scope $scope) use ($error): void { + \Sentry\withScope(function (Sentry\State\Scope $scope) use ($error, $f3): void { $scope->setContext('error_500', $error); \Sentry\captureMessage($error['text']); + session_status() == PHP_SESSION_ACTIVE && Flash::instance()->addMessage(_('We are sorry, something unexpected happened.'), 'danger'); + $f3->reroute('@home'); }); - session_status() == PHP_SESSION_ACTIVE && Flash::instance()->addMessage(_('We are sorry, something unexpected happened.'), 'danger'); - $f3->reroute('@home'); } $header = $f3->status($error['code']); $req = $f3->get('VERB').' '.$f3->get('PATH');