Skip to content

Commit df78a73

Browse files
Merge branch '3.3' into 3.4
* 3.3: Hash cache keys on save [HttpKernel] Remove isset call used for legacy
2 parents 6c0e48d + 267b016 commit df78a73

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,20 @@ function ($key, $value, $isHit) use ($defaultLifetime) {
5555
null,
5656
CacheItem::class
5757
);
58+
$getId = function ($key) { return $this->getId((string) $key); };
5859
$this->mergeByLifetime = \Closure::bind(
59-
function ($deferred, $namespace, &$expiredIds) {
60+
function ($deferred, $namespace, &$expiredIds) use ($getId) {
6061
$byLifetime = array();
6162
$now = time();
6263
$expiredIds = array();
6364

6465
foreach ($deferred as $key => $item) {
6566
if (null === $item->expiry) {
66-
$byLifetime[0 < $item->defaultLifetime ? $item->defaultLifetime : 0][$namespace.$key] = $item->value;
67+
$byLifetime[0 < $item->defaultLifetime ? $item->defaultLifetime : 0][$getId($key)] = $item->value;
6768
} elseif ($item->expiry > $now) {
68-
$byLifetime[$item->expiry - $now][$namespace.$key] = $item->value;
69+
$byLifetime[$item->expiry - $now][$getId($key)] = $item->value;
6970
} else {
70-
$expiredIds[] = $namespace.$key;
71+
$expiredIds[] = $getId($key);
7172
}
7273
}
7374

src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class PhpArrayAdapterTest extends AdapterTestCase
2222
{
2323
protected $skippedTests = array(
2424
'testBasicUsage' => 'PhpArrayAdapter is read-only.',
25+
'testBasicUsageWithLongKey' => 'PhpArrayAdapter is read-only.',
2526
'testClear' => 'PhpArrayAdapter is read-only.',
2627
'testClearWithDeferredItems' => 'PhpArrayAdapter is read-only.',
2728
'testDeleteItem' => 'PhpArrayAdapter is read-only.',

src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
class PhpArrayCacheTest extends CacheTestCase
2222
{
2323
protected $skippedTests = array(
24+
'testBasicUsageWithLongKey' => 'PhpArrayCache does no writes',
25+
2426
'testDelete' => 'PhpArrayCache does no writes',
2527
'testDeleteMultiple' => 'PhpArrayCache does no writes',
2628
'testDeleteMultipleGenerator' => 'PhpArrayCache does no writes',
@@ -57,6 +59,7 @@ protected function tearDown()
5759
FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
5860
}
5961
}
62+
6063
public function createSimpleCache()
6164
{
6265
return new PhpArrayCacheWrapper(self::$file, new NullCache());

src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ public function onKernelTerminate(PostResponseEvent $event)
107107
{
108108
// attach children to parents
109109
foreach ($this->profiles as $request) {
110-
// isset call should be removed when requestStack is required
111-
if (isset($this->parents[$request]) && null !== $parentRequest = $this->parents[$request]) {
110+
if (null !== $parentRequest = $this->parents[$request]) {
112111
if (isset($this->profiles[$parentRequest])) {
113112
$this->profiles[$parentRequest]->addChild($this->profiles[$request]);
114113
}

0 commit comments

Comments
 (0)