From 5199c5cb9d9f4b4c2ce0e4e1538320a071889881 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 22 Aug 2008 01:52:37 +0000 Subject: [PATCH] Fixed issues with inifinite recursion on missing component. Refactored missing helper errors. Closes #5297 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7483 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/error.php | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/cake/libs/error.php b/cake/libs/error.php index 30cea82b8..12a6605ed 100644 --- a/cake/libs/error.php +++ b/cake/libs/error.php @@ -1,9 +1,9 @@ _set(Router::getPaths()); @@ -49,9 +59,11 @@ class CakeErrorController extends AppController { } } /** - * Short description for file. + * Error Handler. * - * Long description for file + * Captures and handles all cakeError() calls. + * Displays helpful framework errors when debug > 1. + * When debug < 1 cakeError() will render 404 or 500 errors. * * @package cake * @subpackage cake.cake.libs @@ -72,8 +84,16 @@ class ErrorHandler extends Object { */ function __construct($method, $messages) { App::import('Core', 'Sanitize'); + static $__previousError = null; + + if ($__previousError != array($method, $messages)) { + $__previousError = array($method, $messages); + $this->controller =& new CakeErrorController(); + } else { + $this->controller =& new Controller(); + $this->controller->viewPath = 'errors'; + } - $this->controller =& new CakeErrorController(); $options = array('escape' => false); $messages = Sanitize::clean($messages, $options); @@ -276,9 +296,6 @@ class ErrorHandler extends Object { function missingHelperFile($params) { extract($params, EXTR_OVERWRITE); - $index = array_search($helper, $this->controller->helpers); - unset($this->controller->helpers[$index]); - $this->controller->set(array( 'helperClass' => Inflector::camelize($helper) . "Helper", 'file' => $file, @@ -295,9 +312,6 @@ class ErrorHandler extends Object { function missingHelperClass($params) { extract($params, EXTR_OVERWRITE); - $index = array_search($helper, $this->controller->helpers); - unset($this->controller->helpers[$index]); - $this->controller->set(array( 'helperClass' => Inflector::camelize($helper) . "Helper", 'file' => $file,