bug #29328 [HttpKernel] handle anonymous classes when generating the dumped container class name (nicolas-grekas)
This PR was merged into the 4.2-dev branch.
Discussion
----------
[HttpKernel] handle anonymous classes when generating the dumped container class name
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #29322
| License | MIT
| Doc PR | -
Commits
-------
ac84cb2fbe
[HttpKernel] handle anonymous classes when generating the dumped container class name
This commit is contained in:
commit
e728edb7b8
@ -225,7 +225,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
public function getBundle($name)
|
||||
{
|
||||
if (!isset($this->bundles[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, \get_class($this)));
|
||||
$class = \get_class($this);
|
||||
$class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class;
|
||||
|
||||
throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, $class));
|
||||
}
|
||||
|
||||
return $this->bundles[$name];
|
||||
@ -443,7 +446,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
||||
*/
|
||||
protected function getContainerClass()
|
||||
{
|
||||
return $this->name.str_replace('\\', '_', \get_class($this)).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container';
|
||||
$class = \get_class($this);
|
||||
$class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).ContainerBuilder::hash($class) : $class;
|
||||
|
||||
return $this->name.str_replace('\\', '_', $class).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user