Relevant piece of code in \Liip\FunctionalTestBundle\Validator\DataCollectingValidator
public function onKernelRequest(GetResponseEvent $event): void
{
if (method_exists($event, 'isMainRequest') && $event->isMainRequest()) {
$this->clearLastErrors();
} elseif ($event->isMasterRequest()) {
$this->clearLastErrors();
}
}
The method onKernelRequest() correctly uses $event->isMainRequest() if the method exists, however the way the condition is constructed, the elseif condition is checked when isMainRequest() returns false. As a result, the deprecated isMasterRequest() method is called unnecessarily.
Preconditions
Using composer package liip/functional-test-bundle 4.4.2
Steps to reproduce
The bug is obvious when looking at the code. To reproduce, call
\Liip\FunctionalTestBundle\Validator\DataCollectingValidator::onKernelRequest() with \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST as the last parameter
Expected result
A deprecation error is not triggered when isMainRequest() exists and returns false.
Actual result
When isMainRequest() exists and returns false, a deprecation error is triggered: php.INFO: User Deprecated: Since symfony/http-kernel 5.3: "Symfony\Component\HttpKernel\Event\KernelEvent::isMasterRequest()" is deprecated, use "isMainRequest()" instead.
Relevant piece of code in
\Liip\FunctionalTestBundle\Validator\DataCollectingValidator
The method
onKernelRequest()
correctly uses$event->isMainRequest()
if the method exists, however the way the condition is constructed, the elseif condition is checked whenisMainRequest()
returns false. As a result, the deprecatedisMasterRequest()
method is called unnecessarily.Preconditions
liip/functional-test-bundle 4.4.2
Steps to reproduce
The bug is obvious when looking at the code. To reproduce, call
\Liip\FunctionalTestBundle\Validator\DataCollectingValidator::onKernelRequest()
with\Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST
as the last parameterExpected result
isMainRequest()
exists and returns false.Actual result
isMainRequest()
exists and returns false, a deprecation error is triggered:php.INFO: User Deprecated: Since symfony/http-kernel 5.3: "Symfony\Component\HttpKernel\Event\KernelEvent::isMasterRequest()" is deprecated, use "isMainRequest()" instead.