modified ErrorHandler not to process error closed by @
This commit is contained in:
@ -23,7 +23,10 @@ class ErrorHandler
|
|||||||
if (!empty($ob_handlers)) {
|
if (!empty($ob_handlers)) {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
|
if (error_reporting() !== 0) {
|
||||||
|
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected function getSource($file, $hiline)
|
static protected function getSource($file, $hiline)
|
||||||
|
@ -39,6 +39,19 @@ class ErrorHandlerTest extends PHPUnit_Framework_TestCase
|
|||||||
trigger_error("test error", E_USER_ERROR);
|
trigger_error("test error", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testHandleAt()
|
||||||
|
{
|
||||||
|
$my_eh = array('ErrorHandler', 'error_handler');
|
||||||
|
ErrorHandler::init();
|
||||||
|
set_error_handler($my_eh);
|
||||||
|
$var = '';
|
||||||
|
$ok = @$var['some'];
|
||||||
|
$this->assertSame('', $var);
|
||||||
|
ob_start();
|
||||||
|
$this->setExpectedException('ErrorException');
|
||||||
|
$ex = $var['some'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @TODO: ErrorHandler->wrapTrace() not used
|
* @TODO: ErrorHandler->wrapTrace() not used
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user