From: Tim Starling Date: Mon, 10 Jun 2019 21:01:39 +0000 (+1000) Subject: REST: HeaderContainer should start empty not null X-Git-Tag: 1.34.0-rc.0~1405 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=f1c11c2c49ef706b88e99c929cd8c62684b15167;p=lhc%2Fweb%2Fwiklou.git REST: HeaderContainer should start empty not null Change-Id: I30b68862307f2b44e4f5708c06464e0a218c1ed5 --- diff --git a/includes/Rest/HeaderContainer.php b/includes/Rest/HeaderContainer.php index 50f4355f2b..a71f6a6ce1 100644 --- a/includes/Rest/HeaderContainer.php +++ b/includes/Rest/HeaderContainer.php @@ -10,9 +10,9 @@ namespace MediaWiki\Rest; * Unlike PSR-7, the container is mutable. */ class HeaderContainer { - private $headerLists; - private $headerLines; - private $headerNames; + private $headerLists = []; + private $headerLines = []; + private $headerNames = []; /** * Erase any existing headers and replace them with the specified diff --git a/tests/phpunit/includes/Rest/HeaderContainerTest.php b/tests/phpunit/includes/Rest/HeaderContainerTest.php index d0fae9f567..e0dbfdf4f6 100644 --- a/tests/phpunit/includes/Rest/HeaderContainerTest.php +++ b/tests/phpunit/includes/Rest/HeaderContainerTest.php @@ -42,6 +42,7 @@ class HeaderContainerTest extends MediaWikiTestCase { [ 'tesT' => [ 'bar' ] ], [ 'tesT' => 'bar' ] ], + 'empty' => [ [], [], [] ], ]; }