Skip to content

Commit 6cafe2e

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: supports() must return a boolean fix the event subscriber code example
2 parents cfc4d43 + 69f7dce commit 6cafe2e

File tree

2 files changed

+7
-43
lines changed

2 files changed

+7
-43
lines changed

security/guard_authentication.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ are two possible fixes:
475475
public function supports(Request $request)
476476
{
477477
+ // if there is already an authenticated user (likely due to the session)
478-
+ // then return null and skip authentication: there is no need.
478+
+ // then return false and skip authentication: there is no need.
479479
+ if ($this->security->getUser()) {
480480
+ return false;
481481
+ }

session/locale_sticky_session.rst

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -171,50 +171,14 @@ event::
171171
$this->session->set('_locale', $user->getLocale());
172172
}
173173
}
174-
}
175-
176-
Then register the listener:
177-
178-
.. configuration-block::
179-
180-
.. code-block:: yaml
181-
182-
# config/services.yaml
183-
services:
184-
App\EventListener\UserLocaleListener:
185-
tags:
186-
- { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin, priority: 15 }
187-
188-
.. code-block:: xml
189-
190-
<!-- config/services.xml -->
191-
<?xml version="1.0" encoding="UTF-8" ?>
192-
<container xmlns="http://symfony.com/schema/dic/services"
193-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
194-
xsi:schemaLocation="http://symfony.com/schema/dic/services
195-
http://symfony.com/schema/dic/services/services-1.0.xsd">
196-
197-
<services>
198-
<service id="App\EventListener\UserLocaleListener">
199-
<tag name="kernel.event_listener"
200-
event="security.interactive_login"
201-
method="onInteractiveLogin" priority=15 />
202-
</service>
203-
</services>
204-
</container>
205174

206-
.. code-block:: php
207-
208-
// config/services.php
209-
use AppBundle\EventListener\UserLocaleListener;
210-
use Symfony\Component\DependencyInjection\Reference;
211-
212-
$container
213-
->register(UserLocaleListener::class)
214-
->addTag(
215-
'kernel.event_listener',
216-
array('event' => 'security.interactive_login', 'method' => 'onInteractiveLogin', 'priority' => 15)
175+
public static function getSubscribedEvents()
176+
{
177+
return array(
178+
SecurityEvents::INTERACTIVE_LOGIN => 'onInteractiveLogin',
217179
);
180+
}
181+
}
218182

219183
.. caution::
220184

0 commit comments

Comments
 (0)