Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c5b65de

Browse filesBrowse files
committed
[ClassLoader] Throw an exception if the cache is not writeable
1 parent 6bd7840 commit c5b65de
Copy full SHA for c5b65de

File tree

1 file changed

+9
-1
lines changed
Filter options

1 file changed

+9
-1
lines changed

‎src/Symfony/Component/ClassLoader/ClassCollectionLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ClassCollectionLoader.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,15 @@ private static function compressCode($code)
275275
*/
276276
private static function writeCacheFile($file, $content)
277277
{
278-
$tmpFile = tempnam(dirname($file), basename($file));
278+
set_error_handler(function () use ($file) {
279+
throw new \RuntimeException(sprintf('Failed to create temporary file in "%s".', dirname($file)));
280+
});
281+
try {
282+
$tmpFile = tempnam(dirname($file), basename($file));
283+
} finally {
284+
restore_error_handler();
285+
}
286+
279287
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
280288
@chmod($file, 0666 & ~umask());
281289

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.