Skip to content
Permalink
Browse files

Ignore errorHandler if warning suppressor (@command()) is used.

  • Loading branch information...
jrbasso committed Dec 2, 2010
1 parent ffaec10 commit aa0bad924724e2f9d7e60a27e0e343665b7feff5
@@ -70,6 +70,9 @@ public static function handleException($exception) {
* @return void
*/
public static function handleError($code, $description, $file = null, $line = null, $context = null) {
if (error_reporting() === 0) {
return;
}
$stderr = self::getStderr();
list($name, $log) = self::_mapErrorCode($code);
$message = sprintf(__('%s in [%s, line %s]'), $description, $file, $line);
@@ -135,6 +135,9 @@ public static function handleException(Exception $exception) {
* @return boolean true if error was handled
*/
public static function handleError($code, $description, $file = null, $line = null, $context = null) {
if (error_reporting() === 0) {
return false;
}
$errorConfig = Configure::read('Error');
list($error, $log) = self::_mapErrorCode($code);
@@ -113,6 +113,21 @@ function testErrorMapping($error, $expected) {
$this->assertPattern('/<b>' . $expected . '<\/b>/', $result);
}
/**
* test error prepended by @
*
* @return void
*/
function testErrorSuppressed() {
set_error_handler('ErrorHandler::handleError');
$this->_restoreError = true;
ob_start();
@include 'invalid.file';
$result = ob_get_clean();
$this->assertTrue(empty($result));
}
/**
* Test that errors go into CakeLog when debug = 0.
*

0 comments on commit aa0bad9

Please sign in to comment.
You can’t perform that action at this time.