bug #34854 [Messenger] gracefully handle missing event dispatchers (xabbuh)
This PR was merged into the 4.3 branch.
Discussion
----------
[Messenger] gracefully handle missing event dispatchers
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #34852
| License | MIT
| Doc PR |
Commits
-------
d4ae85fc72
gracefully handle missing event dispatchers
This commit is contained in:
commit
9a025b44d9
@ -39,7 +39,13 @@ class SendMessageMiddleware implements MiddlewareInterface
|
||||
public function __construct(SendersLocatorInterface $sendersLocator, EventDispatcherInterface $eventDispatcher = null)
|
||||
{
|
||||
$this->sendersLocator = $sendersLocator;
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
|
||||
if (null !== $eventDispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
} else {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
$this->logger = new NullLogger();
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,13 @@ class Worker implements WorkerInterface
|
||||
$this->receivers = $receivers;
|
||||
$this->bus = $bus;
|
||||
$this->retryStrategies = $retryStrategies;
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
|
||||
if (null !== $eventDispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
} else {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,12 @@ class TraceableVoter implements VoterInterface
|
||||
public function __construct(VoterInterface $voter, EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$this->voter = $voter;
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
|
||||
if (class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
} else {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
public function vote(TokenInterface $token, $subject, array $attributes)
|
||||
|
@ -46,7 +46,13 @@ class GuardAuthenticatorHandler
|
||||
public function __construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null, array $statelessProviderKeys = [])
|
||||
{
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
|
||||
if (null !== $eventDispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
$this->statelessProviderKeys = $statelessProviderKeys;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,13 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
|
||||
'require_previous_session' => true,
|
||||
], $options);
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
|
||||
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
$this->httpUtils = $httpUtils;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,12 @@ abstract class AbstractPreAuthenticatedListener implements ListenerInterface
|
||||
$this->authenticationManager = $authenticationManager;
|
||||
$this->providerKey = $providerKey;
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
|
||||
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,13 @@ class ContextListener implements ListenerInterface
|
||||
$this->userProviders = $userProviders;
|
||||
$this->sessionKey = '_security_'.$contextKey;
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
|
||||
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
$this->trustResolver = $trustResolver ?: new AuthenticationTrustResolver(AnonymousToken::class, RememberMeToken::class);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,13 @@ class RememberMeListener implements ListenerInterface
|
||||
$this->rememberMeServices = $rememberMeServices;
|
||||
$this->authenticationManager = $authenticationManager;
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
|
||||
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
$this->catchExceptions = $catchExceptions;
|
||||
$this->sessionStrategy = null === $sessionStrategy ? new SessionAuthenticationStrategy(SessionAuthenticationStrategy::MIGRATE) : $sessionStrategy;
|
||||
}
|
||||
|
@ -65,7 +65,13 @@ class SimplePreAuthenticationListener implements ListenerInterface
|
||||
$this->providerKey = $providerKey;
|
||||
$this->simpleAuthenticator = $simpleAuthenticator;
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
|
||||
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
$this->trustResolver = $trustResolver ?: new AuthenticationTrustResolver(AnonymousToken::class, RememberMeToken::class);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,13 @@ class SwitchUserListener implements ListenerInterface
|
||||
$this->usernameParameter = $usernameParameter;
|
||||
$this->role = $role;
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
|
||||
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
$this->stateless = $stateless;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,13 @@ class UsernamePasswordJsonAuthenticationListener implements ListenerInterface
|
||||
$this->successHandler = $successHandler;
|
||||
$this->failureHandler = $failureHandler;
|
||||
$this->logger = $logger;
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
|
||||
if (null !== $eventDispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
} else {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
$this->options = array_merge(['username_path' => 'username', 'password_path' => 'password'], $options);
|
||||
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
|
||||
}
|
||||
|
@ -43,7 +43,13 @@ class Workflow implements WorkflowInterface
|
||||
{
|
||||
$this->definition = $definition;
|
||||
$this->markingStore = $markingStore ?: new MultipleStateMarkingStore();
|
||||
$this->dispatcher = null !== $dispatcher ? LegacyEventDispatcherProxy::decorate($dispatcher) : null;
|
||||
|
||||
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
} else {
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user