Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 38d71d6

Browse filesBrowse files
smnandrenicolas-grekas
authored andcommitted
[HttpKernel] Ensure controllers are not lazy
Fix #54542
1 parent 3faeb57 commit 38d71d6
Copy full SHA for 38d71d6

File tree

Expand file treeCollapse file tree

2 files changed

+17
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-0
lines changed

‎src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function process(ContainerBuilder $container)
7070
foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) {
7171
$def = $container->getDefinition($id);
7272
$def->setPublic(true);
73+
$def->setLazy(false);
7374
$class = $def->getClass();
7475
$autowire = $def->isAutowired();
7576
$bindings = $def->getBindings();

‎src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Symfony\Component\DependencyInjection\TypedReference;
2626
use Symfony\Component\HttpFoundation\Response;
2727
use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
28+
use Symfony\Component\HttpKernel\Tests\Fixtures\DataCollector\DummyController;
2829
use Symfony\Component\HttpKernel\Tests\Fixtures\Suit;
2930

3031
class RegisterControllerArgumentLocatorsPassTest extends TestCase
@@ -285,6 +286,21 @@ public function testControllersAreMadePublic()
285286
$this->assertTrue($container->getDefinition('foo')->isPublic());
286287
}
287288

289+
public function testControllersAreMadeNonLazy()
290+
{
291+
$container = new ContainerBuilder();
292+
$container->register('argument_resolver.service')->addArgument([]);
293+
294+
$container->register('foo', DummyController::class)
295+
->addTag('controller.service_arguments')
296+
->setLazy(true);
297+
298+
$pass = new RegisterControllerArgumentLocatorsPass();
299+
$pass->process($container);
300+
301+
$this->assertFalse($container->getDefinition('foo')->isLazy());
302+
}
303+
288304
/**
289305
* @dataProvider provideBindings
290306
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.