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 0e542ac

Browse filesBrowse files
committed
Added class existence check if is_subclass_of() fails in compiler passes
1 parent 1f2d6fb commit 0e542ac
Copy full SHA for 0e542ac

File tree

2 files changed

+10
-1
lines changed
Filter options

2 files changed

+10
-1
lines changed

‎src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@ public function process(ContainerBuilder $container)
9797

9898
// We must assume that the class value has been correctly filled, even if the service is created by a factory
9999
$class = $container->getParameterBag()->resolveValue($def->getClass());
100-
101100
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
101+
102102
if (!is_subclass_of($class, $interface)) {
103+
if (!class_exists($class, false)) {
104+
throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" can not be found.', $class, $id));
105+
}
106+
103107
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
104108
}
105109

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php
+5Lines 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" can not 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.