Skip to content

Commit

Permalink
Fixing php4 issues in ErrorHandler and ErrorHandler testcase.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jan 15, 2010
1 parent 547aa76 commit 3a38e08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cake/libs/error.php
Expand Up @@ -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) {
Expand Down
8 changes: 5 additions & 3 deletions cake/tests/cases/libs/error.test.php
Expand Up @@ -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');

Expand Down

0 comments on commit 3a38e08

Please sign in to comment.