فهرست منبع

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

Fabien Potencier 15 سال پیش
والد
کامیت
4a742138e6
3فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 4 1
      src/Symfony/Foundation/ClassCollectionLoader.php
  2. 4 1
      src/Symfony/Foundation/Kernel.php
  3. 4 1
      src/Symfony/Foundation/bootstrap.php

+ 4 - 1
src/Symfony/Foundation/ClassCollectionLoader.php

@@ -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);
     }
 }

+ 4 - 1
src/Symfony/Foundation/Kernel.php

@@ -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);
     }
 

+ 4 - 1
src/Symfony/Foundation/bootstrap.php

@@ -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);
     }
 }