We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8f87c9 commit b703b4fCopy full SHA for b703b4f
src/RobotLoader/RobotLoader.php
@@ -410,9 +410,10 @@ private function loadCache()
410
private function saveCache()
411
{
412
$file = $this->getCacheFile();
413
+ $tempFile = $file . uniqid('', true) . '.tmp';
414
$code = "<?php\nreturn " . var_export([$this->classes, $this->missing], true) . ";\n";
- if (file_put_contents("$file.tmp", $code) !== strlen($code) || !rename("$file.tmp", $file)) {
415
- @unlink("$file.tmp"); // @ - file may not exist
+ if (file_put_contents($tempFile, $code) !== strlen($code) || !rename($tempFile, $file)) {
416
+ @unlink($tempFile); // @ - file may not exist
417
throw new \RuntimeException("Unable to create '$file'.");
418
}
419
if (function_exists('opcache_invalidate')) {
0 commit comments