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 9f7ad90

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

File tree

Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/ClassLoader/ClassCollectionLoader.php
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,13 @@ private static function compressCode($code)
275275
*/
276276
private static function writeCacheFile($file, $content)
277277
{
278-
$tmpFile = tempnam(dirname($file), basename($file));
278+
$dir = dirname($file);
279+
if (!is_writable($dir)) {
280+
throw new \RuntimeException(sprintf('Failed to write cache in directory "%s".', $file));
281+
}
282+
283+
$tmpFile = tempnam($dir, basename($file));
284+
279285
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
280286
@chmod($file, 0666 & ~umask());
281287

0 commit comments

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