Browse Source

Fix uncaught exceptions when generating view cache files

Fixes #3016
mark_story 13 years ago
parent
commit
9b94133f0d
1 changed files with 11 additions and 1 deletions
  1. 11 1
      lib/Cake/View/Helper/CacheHelper.php

+ 11 - 1
lib/Cake/View/Helper/CacheHelper.php

@@ -150,7 +150,17 @@ class CacheHelper extends AppHelper {
 
 		if ($cacheTime != '' && $cacheTime > 0) {
 			$cached = $this->_parseOutput($out);
-			$this->_writeFile($cached, $cacheTime, $useCallbacks);
+			try {
+				$this->_writeFile($cached, $cacheTime, $useCallbacks);
+			} catch (Exception $e) {
+				$message = __d(
+					'cake_dev',
+					'Unable to write view cache file: "%s" for "%s"',
+					$e->getMessage(),
+					$this->request->here
+				);
+				$this->log($message, 'error');
+			}
 			$out = $this->_stripTags($out);
 		}
 		return $out;