merged branch fabpot/bundle-leaks (PR #8947)
This PR was merged into the master branch. Discussion ---------- [HttpKernel] fixes some memory leaks | Q | A | ------------- | --- | Bug fix? | kinda | New feature? | no | BC breaks? | kinda as the Bundle `$reflected` property was removed | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits -------6307f41
[HttpKernel] removed a circular reference that prevents PHP GC to do its job49fe3c7
[HttpKernel] removed the need to use reflection to get a bundle namespace
This commit is contained in:
commit
20fadcdbaf
@ -29,8 +29,8 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
|||||||
abstract class Bundle extends ContainerAware implements BundleInterface
|
abstract class Bundle extends ContainerAware implements BundleInterface
|
||||||
{
|
{
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $reflected;
|
|
||||||
protected $extension;
|
protected $extension;
|
||||||
|
protected $path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boots the Bundle.
|
* Boots the Bundle.
|
||||||
@ -109,11 +109,9 @@ abstract class Bundle extends ContainerAware implements BundleInterface
|
|||||||
*/
|
*/
|
||||||
public function getNamespace()
|
public function getNamespace()
|
||||||
{
|
{
|
||||||
if (null === $this->reflected) {
|
$class = get_class($this);
|
||||||
$this->reflected = new \ReflectionObject($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->reflected->getNamespaceName();
|
return substr($class, 0, strrpos($class, '\\'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,11 +123,12 @@ abstract class Bundle extends ContainerAware implements BundleInterface
|
|||||||
*/
|
*/
|
||||||
public function getPath()
|
public function getPath()
|
||||||
{
|
{
|
||||||
if (null === $this->reflected) {
|
if (null === $this->path) {
|
||||||
$this->reflected = new \ReflectionObject($this);
|
$reflected = new \ReflectionObject($this);
|
||||||
|
$this->path = dirname($reflected->getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return dirname($this->reflected->getFileName());
|
return $this->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user