diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 7ca1e3b7e1..9992e547f5 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -145,7 +145,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 0ffd0ab32e..e764b4db51 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -181,18 +181,18 @@ PHP { try { $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()); @@ -203,12 +203,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(); @@ -231,7 +231,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(); } catch (\Exception $e) {