Преглед на файлове

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