From 988a5dc937c1c45681d6c201f81e31b944d08873 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 28 Apr 2014 20:50:14 +0200 Subject: [PATCH] [Debug] fix ErrorHandlerTest when context is not an array --- src/Symfony/Component/Debug/ErrorHandler.php | 2 +- .../Component/Debug/Tests/ErrorHandlerTest.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 038b8b6a3d..7e8bbc5542 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -126,7 +126,7 @@ class ErrorHandler require __DIR__.'/Exception/ContextErrorException.php'; } - if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS'])) { + if (PHP_VERSION_ID < 50400 && isset($context['GLOBALS']) && is_array($context)) { unset($context['GLOBALS']); } diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index 287eb44335..2731e4630f 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -165,18 +165,18 @@ PHP public function testHandle() { $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(); $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(); $handler = ErrorHandler::register(3); try { - $handler->handle(111, 'foo', 'foo.php', 12, 'foo'); + $handler->handle(111, 'foo', 'foo.php', 12, array()); } catch (\ErrorException $e) { $this->assertSame('111: foo in foo.php line 12', $e->getMessage()); $this->assertSame(111, $e->getSeverity()); @@ -187,12 +187,12 @@ PHP restore_error_handler(); $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(); $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(); @@ -215,7 +215,7 @@ PHP $handler = ErrorHandler::register(E_USER_DEPRECATED); $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(); }