Skip to content

Commit afc39ee

Browse files
committed
add more entropy to generated classnames
- use proxy destination filename to create and md5 salt - apply fabbot patch - inline salt generation
1 parent 3cdb539 commit afc39ee

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
*/
2727
class ProxyDumper implements DumperInterface
2828
{
29+
/**
30+
* @var string
31+
*/
32+
private $salt;
33+
2934
/**
3035
* @var LazyLoadingValueHolderGenerator
3136
*/
@@ -38,9 +43,12 @@ class ProxyDumper implements DumperInterface
3843

3944
/**
4045
* Constructor.
46+
*
47+
* @param string $salt
4148
*/
42-
public function __construct()
49+
public function __construct($salt = '')
4350
{
51+
$this->salt = $salt;
4452
$this->proxyGenerator = new LazyLoadingValueHolderGenerator();
4553
$this->classGenerator = new BaseGeneratorStrategy();
4654
}
@@ -109,6 +117,6 @@ public function getProxyCode(Definition $definition)
109117
*/
110118
private function getProxyClassName(Definition $definition)
111119
{
112-
return str_replace('\\', '', $definition->getClass()).'_'.spl_object_hash($definition);
120+
return str_replace('\\', '', $definition->getClass()).'_'.spl_object_hash($definition).$this->salt;
113121
}
114122
}

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public function getBundle($name, $first = true)
243243
}
244244

245245
/**
246-
* {@inheritDoc}
246+
* {@inheritdoc}
247247
*
248248
* @throws \RuntimeException if a custom resource is hidden by a resource in a derived bundle
249249
*/
@@ -683,7 +683,7 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container
683683
$dumper = new PhpDumper($container);
684684

685685
if (class_exists('ProxyManager\Configuration')) {
686-
$dumper->setProxyDumper(new ProxyDumper());
686+
$dumper->setProxyDumper(new ProxyDumper(md5((string) $cache)));
687687
}
688688

689689
$content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => (string) $cache));

0 commit comments

Comments
 (0)