From 9c0939b888197ce38405256aaa8b59c0b0f4b2d8 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 25 Nov 2012 02:43:50 +0530 Subject: [PATCH] A cleaner way to check if RequestHandler is loaded --- lib/Cake/Controller/CakeErrorController.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Controller/CakeErrorController.php b/lib/Cake/Controller/CakeErrorController.php index 53f500217..6b0423a32 100644 --- a/lib/Cake/Controller/CakeErrorController.php +++ b/lib/Cake/Controller/CakeErrorController.php @@ -52,14 +52,12 @@ class CakeErrorController extends AppController { */ public function __construct($request = null, $response = null) { parent::__construct($request, $response); - if ( - count(Router::extensions()) && - !array_key_exists('RequestHandler', $this->components) && - !in_array('RequestHandler', $this->components, true) - ) { - $this->components[] = 'RequestHandler'; - } $this->constructClasses(); + if (count(Router::extensions()) && + !$this->Components->attached('RequestHandler') + ) { + $this->RequestHandler = $this->Components->load('RequestHandler'); + } if ($this->Components->enabled('Auth')) { $this->Components->disable('Auth'); }