From 7f94fc7f73d5db1d36359423b2dba03dd7732943 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Tue, 22 Jun 2010 21:01:18 +0200 Subject: [PATCH] [Routing] Fixed fatal error when the permission to write cache files was denied --- src/Symfony/Components/Routing/Router.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Components/Routing/Router.php b/src/Symfony/Components/Routing/Router.php index edc0889bc2..af95b929c3 100644 --- a/src/Symfony/Components/Routing/Router.php +++ b/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); } }