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 82fa942

Browse filesBrowse files
committed
added checks for public services on compiler passes that use service id and not references
1 parent a1d0136 commit 82fa942
Copy full SHA for 82fa942

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/RuntimeLoaderPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/RuntimeLoaderPass.php
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ public function process(ContainerBuilder $container)
2828
$definition = $container->getDefinition('twig.runtime_loader');
2929
$mapping = array();
3030
foreach ($container->findTaggedServiceIds('twig.runtime') as $id => $attributes) {
31-
$mapping[$container->getDefinition($id)->getClass()] = $id;
31+
$def = $container->getDefinition($id);
32+
33+
if (!$def->isPublic()) {
34+
throw new InvalidArgumentException(sprintf('The service "%s" must be public as it can be lazy-loaded.', $id));
35+
}
36+
37+
if ($def->isAbstract()) {
38+
throw new InvalidArgumentException(sprintf('The service "%s" must not be abstract as it can be lazy-loaded.', $id));
39+
}
40+
41+
$mapping[$def->getClass()] = $id;
3242
}
3343

3444
$definition->replaceArgument(1, $mapping);

0 commit comments

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