add more entropy to generated classnames
- use proxy destination filename to create and md5 salt - apply fabbot patch - inline salt generation
This commit is contained in:
parent
3cdb539360
commit
afc39ee11f
@ -26,6 +26,11 @@ use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
|
|||||||
*/
|
*/
|
||||||
class ProxyDumper implements DumperInterface
|
class ProxyDumper implements DumperInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $salt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var LazyLoadingValueHolderGenerator
|
* @var LazyLoadingValueHolderGenerator
|
||||||
*/
|
*/
|
||||||
@ -38,9 +43,12 @@ class ProxyDumper implements DumperInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $salt
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct($salt = '')
|
||||||
{
|
{
|
||||||
|
$this->salt = $salt;
|
||||||
$this->proxyGenerator = new LazyLoadingValueHolderGenerator();
|
$this->proxyGenerator = new LazyLoadingValueHolderGenerator();
|
||||||
$this->classGenerator = new BaseGeneratorStrategy();
|
$this->classGenerator = new BaseGeneratorStrategy();
|
||||||
}
|
}
|
||||||
@ -109,6 +117,6 @@ EOF;
|
|||||||
*/
|
*/
|
||||||
private function getProxyClassName(Definition $definition)
|
private function getProxyClassName(Definition $definition)
|
||||||
{
|
{
|
||||||
return str_replace('\\', '', $definition->getClass()).'_'.spl_object_hash($definition);
|
return str_replace('\\', '', $definition->getClass()).'_'.spl_object_hash($definition).$this->salt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle
|
* @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle
|
||||||
*/
|
*/
|
||||||
@ -683,7 +683,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
|||||||
$dumper = new PhpDumper($container);
|
$dumper = new PhpDumper($container);
|
||||||
|
|
||||||
if (class_exists('ProxyManager\Configuration')) {
|
if (class_exists('ProxyManager\Configuration')) {
|
||||||
$dumper->setProxyDumper(new ProxyDumper());
|
$dumper->setProxyDumper(new ProxyDumper(md5((string) $cache)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => (string) $cache));
|
$content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => (string) $cache));
|
||||||
|
Reference in New Issue
Block a user