bug #24906 [Bridge/ProxyManager] Remove direct reference to value holder property (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Bridge/ProxyManager] Remove direct reference to value holder property

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

This fixes https://github.com/Ocramius/ProxyManager/issues/394 on Symfony's side, because proxy-manager v1 is not maintained anymore, but is the only one that works on PHP 5.3/5.5, which we still support.
Cannot be tested easily (but code is run by the existing test suite.)

Commits
-------

af9d6446ea [Bridge/ProxyManager] Remove direct reference to value holder property
This commit is contained in:
Fabien Potencier 2017-11-10 07:28:23 -08:00
commit ae65bd8410
1 changed files with 5 additions and 1 deletions

View File

@ -93,7 +93,11 @@ EOF;
*/
public function getProxyCode(Definition $definition)
{
return $this->classGenerator->generate($this->generateProxyClass($definition));
return preg_replace(
'/(\$this->initializer[0-9a-f]++) && \1->__invoke\(\$this->(valueHolder[0-9a-f]++), (.*?), \1\);/',
'$1 && ($1->__invoke(\$$2, $3, $1) || 1) && $this->$2 = \$$2;',
$this->classGenerator->generate($this->generateProxyClass($definition))
);
}
/**