8000 bug #20844 [Config] Fix checking cache for non existing meta file (ha… · symfony/symfony@6ac1223 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ac1223

Browse files
bug #20844 [Config] Fix checking cache for non existing meta file (hason)
This PR was merged into the 2.8 branch. Discussion ---------- [Config] Fix checking cache for non existing meta file | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | maybe | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 17f02e0 [Config] Fix checking cache for non existing meta file
2 parents 151fe32 + 17f02e0 commit 6ac1223

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ public function isFresh()
7272
return true; // shortcut - if we don't have any checkers we don't need to bother with the meta file at all
7373
}
7474

75-
$metadata = $this->getMetaFile();
76-
if (!is_file($metadata)) {
77-
return true;
78-
}
79-
8075
$metadata = $this->getMetaFile();
8176
if (!is_file($metadata)) {
8277
return false;

src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,16 @@ public function testCacheKeepsContent()
128128

129129
$this->assertSame('FOOBAR', file_get_contents($cache->getPath()));
130130
}
131+
132+
public function testCacheIsNotFreshIfNotExistsMetaFile()
133+
{
134+
$checker = $this->getMockBuilder('\Symfony\Component\Config\ResourceCheckerInterface')->getMock();
135+
$cache = new ResourceCheckerConfigCache($this->cacheFile, array($checker));
136+
$cache->write('foo', array(new FileResource(__FILE__)));
137+
138+
$metaFile = "{$this->cacheFile}.meta";
139+
unlink($metaFile);
140+
141+
$this->assertFalse($cache->isFresh());
142+
}
131143
}

0 commit comments

Comments
 (0)
0