diff --git a/lib/Fhp/BaseAction.php b/lib/Fhp/BaseAction.php index 06cfd9a0..c1f20b9b 100644 --- a/lib/Fhp/BaseAction.php +++ b/lib/Fhp/BaseAction.php @@ -61,8 +61,7 @@ abstract class BaseAction implements \Serializable * * NOTE: A common mistake is to call this function directly. Instead, you probably want `serialize($instance)`. * - * An action can only be serialized *after* it has been executed in case it needs a TAN, i.e. when the result is not - * present yet. + * An action can only be serialized before it was completed. * If a sub-class overrides this, it should call the parent function and include it in its result. * @return string The serialized action, e.g. for storage in a database. This will not contain sensitive user data. */ @@ -72,8 +71,7 @@ public function serialize(): string } /** - * An action can only be serialized *after* it has been executed in case it needs a TAN, i.e. when the result is not - * present yet. + * An action can only be serialized before it was completed. * If a sub-class overrides this, it should call the parent function and include it in its result. * * @return array The serialized action, e.g. for storage in a database. This will not contain sensitive user data. @@ -81,8 +79,8 @@ public function serialize(): string */ public function __serialize(): array { - if (!$this->needsTan()) { - throw new \RuntimeException('Cannot serialize this action, because it is not waiting for a TAN.'); + if ($this->isDone()) { + throw new \RuntimeException('Completed actions cannot be serialized.'); } return [ $this->requestSegmentNumbers,