-
-
Notifications
You must be signed in to change notification settings - Fork 324
WriteProxiesToFile bug #866
Description
Version 7 introduced a bug with ContainerBuilder::writeProxiesToFile().
Previous versions of ProxyFactory had a bool $writeProxiesToFile property.
Since 7.0, these checks were updated from if ($this->writeProxiesToFile) ... to if ($this->proxyDirectory) ....
No issues here.
Prior to 7.0, ProxyFactory was created in ContainerBuilder by new ProxyFactory($this->writeProxiesToFile, $this->proxyDirectory).
Since 7.0, ProxyFactory is created in ContainerBuilder by new ProxyFactory($this->proxyDirectory).
No issues here.
Until you get to ContainerBuilder::writeProxiesToFile(bool $writeToFile, string $proxyDirectory = null):
The writeProxiesToFile parameter essentially has no effect if proxyDirectory has anything other than null.
In other words, writeProxiesToFile(false, 'tmp/proxies') has exactly the same effect as writeProxiesToFile(true, 'tmp/proxies') or even
$builder->writeProxiesToFile(true, 'tmp/proxies');
/* other code */
if ($dontWriteProxiesAnymore) {
$builder->writeProxiesToFile(false);
}or
$builder->writeProxiesToFile($resultOfSomeLogic, $someProxyDirectory);Therefore, to fix this bug, I believe this line should be updated to
$this->proxyDirectory = $writeToFile ? $proxyDirectory : null;Thoughts?