diff --git a/src/Validator/DataCollectingValidator.php b/src/Validator/DataCollectingValidator.php index bc6eba9b..4b0ecde8 100644 --- a/src/Validator/DataCollectingValidator.php +++ b/src/Validator/DataCollectingValidator.php @@ -88,7 +88,9 @@ public function inContext(ExecutionContextInterface $context): ContextualValidat public function onKernelRequest(GetResponseEvent $event): void { - if ($event->isMainRequest()) { + if (method_exists($event, 'isMainRequest') && $event->isMainRequest()) { + $this->clearLastErrors(); + } elseif ($event->isMasterRequest()) { $this->clearLastErrors(); } }