Skip to content

Commit 6a88df4

Browse files
bug #19564 Added class existence check if is_subclass_of() fails in compiler passes (SCIF)
This PR was merged into the 2.7 branch. Discussion ---------- Added class existence check if is_subclass_of() fails in compiler passes | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | comma-separated list of tickets fixed by the PR, if any | License | MIT | Doc PR | no Backport of #19342 to 2.7 branch Commits ------- 77adea7 Added class existence check if is_subclass_of() fails in compiler passes
2 parents da04980 + 077b9a4 commit 6a88df4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

DependencyInjection/FragmentRendererPass.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ public function process(ContainerBuilder $container)
5454

5555
$class = $container->getParameterBag()->resolveValue($def->getClass());
5656
$interface = 'Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface';
57+
5758
if (!is_subclass_of($class, $interface)) {
59+
if (!class_exists($class, false)) {
60+
throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
61+
}
62+
5863
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
5964
}
6065

0 commit comments

Comments
 (0)