bug #25981 [DI] Fix tracking of source class changes for lazy-proxies (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Fix tracking of source class changes for lazy-proxies

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

4f18e4b0dc [DI] Fix tracking of source class changes for lazy-proxies
This commit is contained in:
Fabien Potencier 2018-02-01 05:50:52 +01:00
commit 6cfcfae009
2 changed files with 7 additions and 5 deletions

View File

@ -398,6 +398,8 @@ EOTXT;
if (!$proxyDumper->isProxyCandidate($definition)) {
continue;
}
// register class' reflector for resource tracking
$this->container->getReflectionClass($definition->getClass());
$proxyCode = "\n".$proxyDumper->getProxyCode($definition);
if ($strip) {
$proxyCode = "<?php\n".$proxyCode;
@ -1043,10 +1045,10 @@ EOF;
}
$code .= <<<EOF
protected function createProxy(\$class, \Closure \$factory)
{
{$proxyLoader}return \$factory();
}
protected function createProxy(\$class, \Closure \$factory)
{
{$proxyLoader}return \$factory();
}
EOF;
break;

View File

@ -842,7 +842,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$dumper = new PhpDumper($container);
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
$dumper->setProxyDumper(new ProxyDumper(substr(hash('sha256', $cache->getPath()), 0, 7)));
$dumper->setProxyDumper(new ProxyDumper());
}
$content = $dumper->dump(array(