Skip to content

Commit

Permalink
Fix error output leaking into test output.
Browse files Browse the repository at this point in the history
Returnning true from an error handler indicates to PHP that your error
handler has handled the error and native error handling is not required.
  • Loading branch information
markstory committed Aug 24, 2013
1 parent 50cff13 commit b3e94f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Error/BaseErrorHandler.php
Expand Up @@ -110,7 +110,7 @@ public function handleError($code, $description, $file = null, $line = null, $co
}
$this->_displayError($data, $debug);
$this->_logError($log, $data);
return false;
return true;
}

/**
Expand Down Expand Up @@ -170,7 +170,7 @@ public function handleFatalError($code, $description, $file, $line) {
} else {
$this->handleException(new InternalErrorException());
}
return false;
return true;
}

/**
Expand Down
6 changes: 2 additions & 4 deletions lib/Cake/Test/TestCase/Error/ErrorHandlerTest.php
@@ -1,7 +1,5 @@
<?php
/**
* ErrorHandlerTest file
*
* PHP 5
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
Expand Down Expand Up @@ -306,15 +304,15 @@ public function testHandleFatalErrorPage() {
}

/**
* test handleException generating log.
* test handleFatalError generating log.
*
* @return void
*/
public function testHandleFatalErrorLog() {
$this->_logger->expects($this->at(0))
->method('write')
->with('error', $this->logicalAnd(
$this->stringContains(__FILE__ . ', line 327'),
$this->stringContains(__FILE__ . ', line ' . (__LINE__ + 10)),
$this->stringContains('Fatal Error (1)'),
$this->stringContains('Something wrong')
));
Expand Down

0 comments on commit b3e94f8

Please sign in to comment.