8000 bug #24744 debug:container --types: Fix bug with non-existent classes… · symfony/symfony@1da0ba5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1da0ba5

Browse files
committed
bug #24744 debug:container --types: Fix bug with non-existent classes (weaverryan)
This PR was merged into the 3.3 branch. Discussion ---------- debug:container --types: Fix bug with non-existent classes | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24639 | License | MIT | Doc PR | n/a I've just tested manually that this *does* fix the issue I described in #24639. Oddly enough, in a "stock" Flex project, after this patch, there is one *additional* "type" that's reported: > Symfony\Component\PropertyAccess\PropertyAccessorInterface alias for "property_accessor" That is a valid type... for some reason `interface_exists()` return false for this (??? maybe a quirk of my machine). Anyways, this is also "fixed" with this new approach. Commits ------- 4bb9d82 Fixing a bug where non-existent classes would cause issues
2 parents e7b555e + 4bb9d82 commit 1da0ba5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,18 @@ public function filterToServiceTypes($serviceId)
238238
return false;
239239
}
240240

241-
// see if the class exists (only need to trigger autoload once)
242-
return class_exists($serviceId) || interface_exists($serviceId, false);
241+
// if the id has a \, assume it is a class
242+
if (false !== strpos($serviceId, '\\')) {
243+
return true;
244+
}
245+
246+
try {
247+
$r = new \ReflectionClass($serviceId);
248+
249+
return true;
250+
} catch (\ReflectionException $e) {
251+
// the service id is not a valid class/interface
252+
return false;
253+
}
243254
}
244255
}

0 commit comments

Comments
 (0)
0