You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
::setFactory() declares its argument as a callable:
public static function setFactory(?callable $callable): void
{
self::$requestFactory = $callable;
}
How to reproduce
Drupal calls ::setFactory() with a callable that isn't a closure:
$request_factory = new TrustedHostsRequestFactory('localhost');
Request::setFactory([$request_factory, 'createRequest']);
In Symfony 7 this results in
PHP Fatal error: Uncaught TypeError: Cannot assign array to property Symfony\Component\HttpFoundation\Request::$requestFactory of type ?Closure
Possible Solution
Either convert the callable to a closure internally with Closure::fromCallable() or change the typehint of the setFactory() argument to \Closure, unsure which is the preferred solution here.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Symfony version(s) affected
7.0.0
Description
Request
declares$requestFactory
as a closure:::setFactory()
declares its argument as a callable:How to reproduce
Drupal calls
::setFactory()
with a callable that isn't a closure:In Symfony 7 this results in
Possible Solution
Either convert the callable to a closure internally with
Closure::fromCallable()
or change the typehint of thesetFactory()
argument to\Closure
, unsure which is the preferred solution here.Additional Context
No response
The text was updated successfully, but these errors were encountered: