Browse Source

modified ErrorHandler not to process error closed by @

master
Anton Grebnev 12 years ago
parent
commit
8d60abe7d1
  1. 5
      exception/ErrorHandler.php
  2. 13
      tests/exception/ErrorHandlerTest.php

5
exception/ErrorHandler.php

@ -23,7 +23,10 @@ class ErrorHandler
if (!empty($ob_handlers)) {
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)

13
tests/exception/ErrorHandlerTest.php

@ -39,6 +39,19 @@ class ErrorHandlerTest extends PHPUnit_Framework_TestCase
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
*/

Loading…
Cancel
Save