Skip to content

[DependencyInjection][ProxyManagerBridge] Don't call class_exists() on null #41233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function generate(\ReflectionClass $originalClass, ClassGenerator $classG
public function getProxifiedClass(Definition $definition): ?string
{
if (!$definition->hasTag('proxy')) {
return class_exists($class = $definition->getClass()) || interface_exists($class, false) ? $class : null;
return ($class = $definition->getClass()) && (class_exists($class) || interface_exists($class, false)) ? $class : null;
}
if (!$definition->isLazy()) {
throw new \InvalidArgumentException(sprintf('Invalid definition for service of class "%s": setting the "proxy" tag on a service requires it to be "lazy".', $definition->getClass()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,13 @@ protected function processValue($value, $isRoot = false)
return parent::processValue($value, $isRoot);
}

if (!$this->autoload && !class_exists($class = $value->getClass(), false) && !interface_exists($class, false)) {
return parent::processValue($value, $isRoot);
if (!$this->autoload) {
if (!$class = $value->getClass()) {
return parent::processValue($value, $isRoot);
}
if (!class_exists($class, false) && !interface_exists($class, false)) {
return parent::processValue($value, $isRoot);
}
}

if (ServiceLocator::class === $value->getClass()) {
Expand Down