Skip to content

Handle race condition when creating cache directory #329

Handle race condition when creating cache directory

Handle race condition when creating cache directory #329

Triggered via pull request January 12, 2025 05:29
@vjikvjik
synchronize #89
mkdir-fix
Status Success
Total duration 47s
Artifacts

mutation.yml

on: pull_request
Matrix: mutation / roave-infection
Fit to window
Zoom out
Zoom in

Annotations

4 warnings
mutation / PHP 8.3-ubuntu-latest
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
mutation / PHP 8.3-ubuntu-latest: src/FileCache.php#L94
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * * @throws CacheException If failed to create cache directory. */ - public function __construct(private string $cachePath, private int $directoryMode = 0775) + public function __construct(private string $cachePath, private int $directoryMode = 510) { } public function get(string $key, mixed $default = null) : mixed
mutation / PHP 8.3-ubuntu-latest: src/FileCache.php#L130
Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ // If ownership differs, the touch call will fail, so we try to // rebuild the file from scratch by deleting it first // https://github.com/yiisoft/yii2/pull/16120 - if (function_exists('posix_geteuid') && is_file($file) && fileowner($file) !== posix_geteuid()) { + if (!function_exists('posix_geteuid') && is_file($file) && fileowner($file) !== posix_geteuid()) { @Unlink($file); } if (file_put_contents($file, serialize($value), LOCK_EX) === false) {
mutation / PHP 8.3-ubuntu-latest: src/FileCache.php#L178
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function getMultiple(iterable $keys, mixed $default = null) : iterable { $keys = $this->iterableToArray($keys); - $this->validateKeys($keys); + $results = []; foreach ($keys as $key) { $results[$key] = $this->get($key, $default);