Merge branch '2.4'

* 2.4:
  [Debug] fix ErrorHandlerTest when context is not an array
This commit is contained in:
Fabien Potencier 2014-04-29 08:56:05 +02:00
commit 9c202eacbc
2 changed files with 7 additions and 7 deletions

View File

@ -166,7 +166,7 @@ class ErrorHandler
return true; return true;
} }
if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS'])) { if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS']) && is_array($context)) {
unset($context['GLOBALS']); unset($context['GLOBALS']);
} }

View File

@ -112,18 +112,18 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
{ {
try { try {
$handler = ErrorHandler::register(0); $handler = ErrorHandler::register(0);
$this->assertFalse($handler->handle(0, 'foo', 'foo.php', 12, 'foo')); $this->assertFalse($handler->handle(0, 'foo', 'foo.php', 12, array()));
restore_error_handler(); restore_error_handler();
$handler = ErrorHandler::register(3); $handler = ErrorHandler::register(3);
$this->assertFalse($handler->handle(4, 'foo', 'foo.php', 12, 'foo')); $this->assertFalse($handler->handle(4, 'foo', 'foo.php', 12, array()));
restore_error_handler(); restore_error_handler();
$handler = ErrorHandler::register(3); $handler = ErrorHandler::register(3);
try { try {
$handler->handle(111, 'foo', 'foo.php', 12, 'foo'); $handler->handle(111, 'foo', 'foo.php', 12, array());
} catch (\ErrorException $e) { } catch (\ErrorException $e) {
$this->assertSame('111: foo in foo.php line 12', $e->getMessage()); $this->assertSame('111: foo in foo.php line 12', $e->getMessage());
$this->assertSame(111, $e->getSeverity()); $this->assertSame(111, $e->getSeverity());
@ -134,12 +134,12 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
restore_error_handler(); restore_error_handler();
$handler = ErrorHandler::register(E_USER_DEPRECATED); $handler = ErrorHandler::register(E_USER_DEPRECATED);
$this->assertTrue($handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, 'foo')); $this->assertTrue($handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array()));
restore_error_handler(); restore_error_handler();
$handler = ErrorHandler::register(E_DEPRECATED); $handler = ErrorHandler::register(E_DEPRECATED);
$this->assertTrue($handler->handle(E_DEPRECATED, 'foo', 'foo.php', 12, 'foo')); $this->assertTrue($handler->handle(E_DEPRECATED, 'foo', 'foo.php', 12, array()));
restore_error_handler(); restore_error_handler();
@ -162,7 +162,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$handler = ErrorHandler::register(E_USER_DEPRECATED); $handler = ErrorHandler::register(E_USER_DEPRECATED);
$handler->setLogger($logger); $handler->setLogger($logger);
$handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, 'foo'); $handler->handle(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array());
restore_error_handler(); restore_error_handler();