Skip to content

Commit 4816fbb

Browse files
authored
Fix #20300: Clear stat cache in FileCache::setValue()
1 parent 136a748 commit 4816fbb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Yii Framework 2 Change Log
2323
- New #20185: Add `BackedEnum` support to `AttributeTypecastBehavior` (briedis)
2424
- Bug #17365: Fix "Trying to access array offset on null" warning (xcopy)
2525
- Bug #20296: Fix broken enum test (briedis)
26+
- Bug #20300: Clear stat cache in `FileCache::setValue()` (rob006)
2627

2728
2.0.51 July 18, 2024
2829
--------------------

caching/FileCache.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ protected function setValue($key, $value, $duration)
155155
$duration = 31536000; // 1 year
156156
}
157157

158-
return @touch($cacheFile, $duration + time());
158+
if (@touch($cacheFile, $duration + time())) {
159+
clearstatcache();
160+
return true;
161+
}
162+
163+
return false;
159164
}
160165

161166
$message = "Unable to write cache file '{$cacheFile}'";

0 commit comments

Comments
 (0)