Skip to content

Commit 2ce6a34

Browse files
committed
feature #29186 [HttpKernel] Increase priority of AddRequestFormatsListener (thewilkybarkid)
This PR was merged into the 4.3-dev branch. Discussion ---------- [HttpKernel] Increase priority of AddRequestFormatsListener | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19469 | License | MIT | Doc PR | Currently `AddRequestFormatsListener` has a low priority, so it won't fire before others like `RouterListener` which can create problems (eg when listening for a HTTP exception thrown by the router you don't have access for any custom types). IMO this map should be in the application rather than set on every request, but the same can be achieved by giving it a high priority. (Can't think of a reason for it to not be first...) Commits ------- 9bf3136 Increase priority of AddRequestFormatsListener
2 parents c7d6bda + 9bf3136 commit 2ce6a34

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.3.0
5+
-----
6+
7+
* increased the priority of `Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener`
8+
49
4.2.0
510
-----
611

src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ public function onKernelRequest(GetResponseEvent $event)
4545
*/
4646
public static function getSubscribedEvents()
4747
{
48-
return array(KernelEvents::REQUEST => array('onKernelRequest', 1));
48+
return array(KernelEvents::REQUEST => array('onKernelRequest', 100));
4949
}
5050
}

src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testIsAnEventSubscriber()
4646
public function testRegisteredEvent()
4747
{
4848
$this->assertEquals(
49-
array(KernelEvents::REQUEST => array('onKernelRequest', 1)),
49+
array(KernelEvents::REQUEST => array('onKernelRequest', 100)),
5050
AddRequestFormatsListener::getSubscribedEvents()
5151
);
5252
}

0 commit comments

Comments
 (0)