From: jenkins-bot Date: Wed, 26 Jun 2019 22:39:11 +0000 (+0000) Subject: Merge "Follow up to 'Remove support for the deprecated Key header'" X-Git-Tag: 1.34.0-rc.0~1278 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=b76b9e9745955cdd0b610927800dfb6e2a660008;hp=defd9ac11decf06188f636682efdebbab7a9e363;p=lhc%2Fweb%2Fwiklou.git Merge "Follow up to 'Remove support for the deprecated Key header'" --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index b8cbff1da2..4ccb0d4274 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2278,7 +2278,7 @@ class OutputPage extends ContextSource { } /** - * T23672: Add Accept-Language to Vary and Key headers if there's no 'variant' parameter in GET. + * T23672: Add Accept-Language to Vary header if there's no 'variant' parameter in GET. * * For example: * /w/index.php?title=Main_page will vary based on Accept-Language; but diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php index 98c04995a3..3810565bcb 100644 --- a/includes/session/SessionManager.php +++ b/includes/session/SessionManager.php @@ -329,12 +329,9 @@ final class SessionManager implements SessionManagerInterface { $headers = []; foreach ( $this->getProviders() as $provider ) { foreach ( $provider->getVaryHeaders() as $header => $options ) { - if ( !isset( $headers[$header] ) ) { - $headers[$header] = []; - } - if ( is_array( $options ) ) { - $headers[$header] = array_unique( array_merge( $headers[$header], $options ) ); - } + # Note that the $options value returned has been deprecated + # and is ignored. + $headers[$header] = null; } } $this->varyHeaders = $headers; diff --git a/includes/session/SessionManagerInterface.php b/includes/session/SessionManagerInterface.php index c6990fefe7..7c05cfc6a6 100644 --- a/includes/session/SessionManagerInterface.php +++ b/includes/session/SessionManagerInterface.php @@ -96,6 +96,9 @@ interface SessionManagerInterface extends LoggerAwareInterface { * } * @endcode * + * Note that the $options argument to OutputPage::addVaryHeader() has + * been deprecated and should always be null. + * * @return array */ public function getVaryHeaders(); diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 5f0067deff..25de1a3523 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -2250,7 +2250,6 @@ class OutputPageTest extends MediaWikiTestCase { * @param array[] $calls For each array, call addVaryHeader() with those arguments * @param string[] $cookies Array of cookie names to vary on * @param string $vary Text of expected Vary header (including the 'Vary: ') - * @param string $key Text of expected Key header (including the 'Key: ') */ public function testVaryHeaders( array $calls, array $cookies, $vary ) { // Get rid of default Vary fields diff --git a/tests/phpunit/includes/session/SessionManagerTest.php b/tests/phpunit/includes/session/SessionManagerTest.php index b33cd24a34..cd0867d2ef 100644 --- a/tests/phpunit/includes/session/SessionManagerTest.php +++ b/tests/phpunit/includes/session/SessionManagerTest.php @@ -711,10 +711,10 @@ class SessionManagerTest extends MediaWikiTestCase { ] ); $expect = [ - 'Foo' => [], - 'Bar' => [ 'X', 'Bar1', 3 => 'Bar2' ], - 'Quux' => [ 'Quux' ], - 'Baz' => [], + 'Foo' => null, + 'Bar' => null, + 'Quux' => null, + 'Baz' => null, ]; $this->assertEquals( $expect, $manager->getVaryHeaders() );