mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Ignore errorHandler if warning suppressor (@command()) is used.
This commit is contained in:
parent
ffaec10a7c
commit
aa0bad9247
3 changed files with 21 additions and 0 deletions
|
@ -70,6 +70,9 @@ class ConsoleErrorHandler extends ErrorHandler {
|
|||
* @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 @@ class ErrorHandler {
|
|||
* @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 @@ class ErrorHandlerTest extends CakeTestCase {
|
|||
$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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue