Fixed fatal error when the permission to write cache files was denied

This commit is contained in:
Fabien Potencier 2010-06-23 07:35:46 +02:00
parent 7f94fc7f73
commit 4a742138e6
3 changed files with 12 additions and 3 deletions

View File

@ -95,7 +95,10 @@ class ClassCollectionLoader
die(sprintf('Failed to write cache file "%s" (cache corrupted).', $tmpFile));
}
@rename($tmpFile, $file);
if (!@rename($tmpFile, $file)) {
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
}
chmod($file, 0644);
}
}

View File

@ -427,7 +427,10 @@ abstract class Kernel implements HttpKernelInterface, \Serializable
die(sprintf('Failed to write cache file "%s" (cache corrupted).', $tmpFile));
}
@rename($tmpFile, $file);
if (!@rename($tmpFile, $file)) {
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
}
chmod($file, 0644);
}

View File

@ -384,7 +384,10 @@ class ClassCollectionLoader
die(sprintf('Failed to write cache file "%s" (cache corrupted).', $tmpFile));
}
@rename($tmpFile, $file);
if (!@rename($tmpFile, $file)) {
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
}
chmod($file, 0644);
}
}