Skip to content

Commit acfe694

Browse files
Merge branch '3.1'
* 3.1: [Cache] Make directory hashing case insensitive
2 parents 01b6afe + 24232e8 commit acfe694

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

DependencyInjection/Compiler/CachePoolPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function process(ContainerBuilder $container)
8989

9090
private function getNamespace($namespaceSuffix, $id)
9191
{
92-
return substr(str_replace('/', '-', base64_encode(md5($id.$namespaceSuffix, true))), 0, 10);
92+
return substr(str_replace('/', '-', base64_encode(hash('sha256', $id.$namespaceSuffix, true))), 0, 10);
9393
}
9494

9595
/**

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild
12351235

12361236
private function registerCacheConfiguration(array $config, ContainerBuilder $container)
12371237
{
1238-
$version = substr(str_replace('/', '-', base64_encode(md5(uniqid(mt_rand(), true), true))), 0, -2);
1238+
$version = substr(str_replace('/', '-', base64_encode(hash('sha256', uniqid(mt_rand(), true), true))), 0, 22);
12391239
$container->getDefinition('cache.adapter.apcu')->replaceArgument(2, $version);
12401240
$container->getDefinition('cache.adapter.system')->replaceArgument(2, $version);
12411241
$container->getDefinition('cache.adapter.filesystem')->replaceArgument(2, $config['directory']);

Tests/DependencyInjection/Compiler/CachePoolPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testNamespaceArgumentIsReplaced()
4141

4242
$this->cachePoolPass->process($container);
4343

44-
$this->assertSame('VcRIZlUhEv', $cachePool->getArgument(0));
44+
$this->assertSame('kRFqMp5odS', $cachePool->getArgument(0));
4545
}
4646

4747
public function testArgsAreReplaced()
@@ -61,7 +61,7 @@ public function testArgsAreReplaced()
6161

6262
$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
6363
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
64-
$this->assertSame('VcRIZlUhEv', $cachePool->getArgument(1));
64+
$this->assertSame('kRFqMp5odS', $cachePool->getArgument(1));
6565
$this->assertSame(3, $cachePool->getArgument(2));
6666
}
6767

0 commit comments

Comments
 (0)