diff --git a/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php b/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php index 9e1475cd4c..6314e9e614 100644 --- a/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php +++ b/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php @@ -78,12 +78,12 @@ class TokenManipulator implements ManipulatorInterface $now = (new \DateTime())->format('Y-m-d H:i:s'); $stmtParms = [ ':value' => null, - ':user_id' => $user->getId(), + ':user_id' => $user ? $user->getId() : null, ':type' => $type, ':data' => $data, ':created' => $now, ':updated' => $now, - ':expiration' => ($expiration === null ? null : $expiration->format('Y-m-d H:i:s')) + ':expiration' => $expiration ? $expiration->format('Y-m-d H:i:s') : null ]; for($try=0; $try<1024; $try++) { $stmtParms['value'] = $this->random->generateString(32, self::LETTERS_AND_NUMBERS);