diff --git a/cake/libs/error.php b/cake/libs/error.php index abe8a50633e..9beb1d59933 100644 --- a/cake/libs/error.php +++ b/cake/libs/error.php @@ -112,8 +112,8 @@ function __construct($method, $messages) { if (strtolower($parentClass) != 'errorhandler') { $method = 'error404'; } - $parentMethods = get_class_methods($parentClass); - if (in_array($method, $parentMethods)) { + $parentMethods = array_map('strtolower', get_class_methods($parentClass)); + if (in_array(strtolower($method), $parentMethods)) { $method = 'error404'; } if (isset($code) && $code == 500) { diff --git a/cake/tests/cases/libs/error.test.php b/cake/tests/cases/libs/error.test.php index c8c2c116ae0..d9ddfdd347c 100644 --- a/cake/tests/cases/libs/error.test.php +++ b/cake/tests/cases/libs/error.test.php @@ -279,19 +279,21 @@ function testSubclassMethodsNotBeingConvertedToError() { $back = Configure::read('debug'); Configure::write('debug', 2); ob_start(); - $ErrorHandler = new MyCustomErrorHandler('missingWidgetThing', array('message' => 'doh!')); + $ErrorHandler =& new MyCustomErrorHandler('missingWidgetThing', array('message' => 'doh!')); $result = ob_get_clean(); $this->assertEqual($result, 'widget thing is missing'); Configure::write('debug', 0); ob_start(); - $ErrorHandler = new MyCustomErrorHandler('missingWidgetThing', array('message' => 'doh!')); + $ErrorHandler =& new MyCustomErrorHandler('missingWidgetThing', array('message' => 'doh!')); $result = ob_get_clean(); $this->assertEqual($result, 'widget thing is missing', 'Method declared in subclass converted to error404. %s'); Configure::write('debug', 0); ob_start(); - $ErrorHandler = new MyCustomErrorHandler('missingController', array('message' => 'Page not found')); + $ErrorHandler =& new MyCustomErrorHandler('missingController', array( + 'className' => 'Missing', 'message' => 'Page not found' + )); $result = ob_get_clean(); $this->assertPattern('/Not Found/', $result, 'Method declared in error handler not converted to error404. %s');