8000 bug #50099 [Cache] Fix success interpretation when pruning cache (sta… · symfony/symfony@d1d7539 · GitHub
[go: up one dir, main page]

Skip to content

Commit d1d7539

Browse files
committed
bug #50099 [Cache] Fix success interpretation when pruning cache (staabm)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] Fix success interpretation when pruning cache | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> As discussed in #50095 this PR fixes the interpretation when cache-pruning is considered successfull. This is changed to use the same semantics used in other places of the codebase, e.g. https://github.com/symfony/symfony/blob/51666290232ee13165c98fa9e40d3475a3cabfd8/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php#L62 https://github.com/symfony/symfony/blob/51666290232ee13165c98fa9e40d3475a3cabfd8/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php#L74 Commits ------- 76a2e62 [Cache] Fix success interpretation when pruning cache
2 parents 867f025 + 76a2e62 commit d1d7539

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function prune()
8282
}
8383

8484
if ($time >= $expiresAt) {
85-
$pruned = $this->doUnlink($file) && !file_exists($file) && $pruned;
85+
$pruned = ($this->doUnlink($file) || !file_exists($file)) && $pruned;
8686
}
8787
}
8888
} finally {

src/Symfony/Component/Cache/Traits/FilesystemTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function prune()
4040

4141
if (($expiresAt = (int) fgets($h)) && $time >= $expiresAt) {
4242
fclose($h);
43-
$pruned = @unlink($file) && !file_exists($file) && $pruned;
43+
$pruned = (@unlink($file) || !file_exists($file)) && $pruned;
4444
} else {
4545
fclose($h);
4646
}

0 commit comments

Comments
 (0)
0