Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d560800

Browse filesBrowse files
bug #45029 [Cache] Set mtime of cache files 1 year into future if they do not expire (Blacksmoke16)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Cache] Set mtime of cache files 1 year into future if they do not expire | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? |no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - #26127 made is so that `0` is used to represent cache files that do not expire. However this was causing `touch` to be called with `0`, which was setting the create/modification time of the file to start of epoch time, which doesn't really make sense. It can cause some issues with `tar` for example as when timezones are taken into consideration you end up with warnings like: > tar: app/cache/prod/annotations/@/+/3/cdcAWwqaPORAi0TfsO5Q: implausibly old time stamp 1969-12-31 19:00:00 Given the expiration of the files is stored within the file itself, it's probably safe to not `touch` it if that value is `0`. However is there actually a reason to touch it at all as a file that expires in 6 hours would show as created 6 hours into the future. I also wasn't sure how to test this, so open to suggestions on that/if we need the `touch` at all. Commits ------- 57cad6f [Cache] Set mtime of cache files 1 year into future if they do not expire
2 parents 99b4885 + 57cad6f commit d560800
Copy full SHA for d560800

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

‎src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private function write(string $file, string $data, int $expiresAt = null)
109109
fclose($h);
110110

111111
if (null !== $expiresAt) {
112-
touch($this->tmp, $expiresAt);
112+
touch($this->tmp, $expiresAt ?: time() + 31556952); // 1 year in seconds
113113
}
114114

115115
return rename($this->tmp, $file);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.