Skip to content

Commit 00f474c

Browse files
committed
Merge branch '4.3' into 4.4
* 4.3: Update the code related to controllers in events
2 parents 65fc840 + 235535b commit 00f474c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

event_dispatcher/before_after_filters.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,13 @@ event subscribers, you can learn more about them at :doc:`/event_dispatcher`::
132132
{
133133
$controller = $event->getController();
134134

135-
/*
136-
* $controller passed can be either a class or a Closure.
137-
* This is not usual in Symfony but it may happen.
138-
* If it is a class, it comes in array format
139-
*/
140-
if (!is_array($controller)) {
141-
return;
135+
// when a controller class defines multiple action methods, the controller
136+
// is returned as [$controllerInstance, 'methodName']
137+
if (is_array($controller)) {
138+
$controller = $controller[0];
142139
}
143140

144-
if ($controller[0] instanceof TokenAuthenticatedController) {
141+
if ($controller instanceof TokenAuthenticatedController) {
145142
$token = $event->getRequest()->query->get('token');
146143
if (!in_array($token, $this->tokens)) {
147144
throw new AccessDeniedHttpException('This action needs a valid token!');

0 commit comments

Comments
 (0)