Skip to content

Commit 20fadcd

Browse files
committed
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 job 49fe3c7 [HttpKernel] removed the need to use reflection to get a bundle namespace
2 parents 8432950 + 6307f41 commit 20fadcd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Symfony/Component/HttpKernel/Bundle/Bundle.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
abstract class Bundle extends ContainerAware implements BundleInterface
3030
{
3131
protected $name;
32-
protected $reflected;
3332
protected $extension;
33+
protected $path;
3434

3535
/**
3636
* Boots the Bundle.
@@ -109,11 +109,9 @@ public function getContainerExtension()
109109
*/
110110
public function getNamespace()
111111
{
112-
if (null === $this->reflected) {
113-
$this->reflected = new \ReflectionObject($this);
114-
}
112+
$class = get_class($this);
115113

116-
return $this->reflected->getNamespaceName();
114+
return substr($class, 0, strrpos($class, '\\'));
117115
}
118116

119117
/**
@@ -125,11 +123,12 @@ public function getNamespace()
125123
*/
126124
public function getPath()
127125
{
128-
if (null === $this->reflected) {
129-
$this->reflected = new \ReflectionObject($this);
126+
if (null === $this->path) {
127+
$reflected = new \ReflectionObject($this);
128+
$this->path = dirname($reflected->getFileName());
130129
}
131130

132-
return dirname($this->reflected->getFileName());
131+
return $this->path;
133132
}
134133

135134
/**

0 commit comments

Comments
 (0)