Skip to content

Commit af27fbe

Browse files
committed
[ClassLoader] Throw an exception if the cache is not writeable
1 parent 6bd7840 commit af27fbe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Symfony/Component/ClassLoader/ClassCollectionLoader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,10 @@ private static function compressCode($code)
275275
*/
276276
private static function writeCacheFile($file, $content)
277277
{
278-
$tmpFile = tempnam(dirname($file), basename($file));
278+
if (false === $tmpFile = @tempnam(dirname($file), basename($file))) {
279+
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
280+
}
281+
279282
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
280283
@chmod($file, 0666 & ~umask());
281284

0 commit comments

Comments
 (0)