From b6676cc8cfce5804a6ae5928ab7373a17f5b75b5 Mon Sep 17 00:00:00 2001 From: Ben Upex <> Date: Tue, 3 Aug 2021 14:53:14 +0100 Subject: [PATCH] Ensures isMainRequest method is available before call is made to allow deprecated isMasterRequest method to be called for Symfony 4 --- src/Validator/DataCollectingValidator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); } }