Skip to content

Handle race condition when creating cache directory (#89) #331

Handle race condition when creating cache directory (#89)

Handle race condition when creating cache directory (#89) #331

Triggered via push January 13, 2025 10:34
Status Success
Total duration 49s
Artifacts

mutation.yml

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

Annotations

5 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#L108
Escaped Mutant for Mutator "FunctionCallRemoval": --- Original +++ New @@ @@ if (!$this->existsAndNotExpired($file) || ($filePointer = @fopen($file, 'rb')) === false) { return $default; } - flock($filePointer, LOCK_SH); + $value = stream_get_contents($filePointer); flock($filePointer, LOCK_UN); fclose($filePointer);
mutation / PHP 8.3-ubuntu-latest: src/FileCache.php#L131
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#L192
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function setMultiple(iterable $values, null|int|DateInterval $ttl = null) : bool { $values = $this->iterableToArray($values); - $this->validateKeys(array_map('\\strval', array_keys($values))); + foreach ($values as $key => $value) { $this->set((string) $key, $value, $ttl); }
mutation / PHP 8.3-ubuntu-latest: src/FileCache.php#L346
Escaped Mutant for Mutator "UnwrapFinally": --- Original +++ New @@ @@ } throw new CacheException(sprintf('Failed to create directory "%s". %s', $path, $errorString), $errorNumber); }); - try { - mkdir($path, recursive: true); - } finally { - restore_error_handler(); - } + mkdir($path, recursive: true); + restore_error_handler(); chmod($path, $this->directoryMode); } /**