Skip to content

Commit

Permalink
Fix memory leak in Doctrine Autoload Proxy Magic
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Feb 23, 2012
1 parent f530057 commit 12fb9e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DoctrineBundle.php
Expand Up @@ -48,9 +48,11 @@ public function boot()
if ($this->container->hasParameter('doctrine.orm.proxy_namespace')) { if ($this->container->hasParameter('doctrine.orm.proxy_namespace')) {
$namespace = $this->container->getParameter('doctrine.orm.proxy_namespace'); $namespace = $this->container->getParameter('doctrine.orm.proxy_namespace');
$dir = $this->container->getParameter('doctrine.orm.proxy_dir'); $dir = $this->container->getParameter('doctrine.orm.proxy_dir');
$container = $this->container; // See https://github.com/symfony/symfony/pull/3419 for usage of
// references
$container =& $this->container;


spl_autoload_register(function($class) use ($namespace, $dir, $container) { spl_autoload_register(function($class) use ($namespace, $dir, &$container) {
if (0 === strpos($class, $namespace)) { if (0 === strpos($class, $namespace)) {
$className = str_replace('\\', '', substr($class, strlen($namespace) +1)); $className = str_replace('\\', '', substr($class, strlen($namespace) +1));
$file = $dir.DIRECTORY_SEPARATOR.$className.'.php'; $file = $dir.DIRECTORY_SEPARATOR.$className.'.php';
Expand Down

0 comments on commit 12fb9e5

Please sign in to comment.