瀏覽代碼

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

Bernhard Schussek 15 年之前
父節點
當前提交
7f94fc7f73
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/Symfony/Components/Routing/Router.php

+ 4 - 1
src/Symfony/Components/Routing/Router.php

@@ -254,7 +254,10 @@ class Router implements RouterInterface
             throw new \RuntimeException(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);
     }
 }