Follow up to 'Remove support for the deprecated Key header'
authorC. Scott Ananian <cscott@cscott.net>
Thu, 18 Oct 2018 16:01:23 +0000 (12:01 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Thu, 20 Jun 2019 19:01:51 +0000 (15:01 -0400)
Clean up a few more code paths and documentation bits left behind by
Ia53d07cd8ce8ab1497294ea244c13c7499f632c7.

Change-Id: I2bb1749c45bb79b27c5a3b2e1b8ed3395e8c11e0

includes/OutputPage.php
includes/session/SessionManager.php
includes/session/SessionManagerInterface.php
tests/phpunit/includes/OutputPageTest.php
tests/phpunit/includes/session/SessionManagerTest.php

index fba75ec..4977a26 100644 (file)
@@ -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
index 98c0499..3810565 100644 (file)
@@ -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;
index c6990fe..7c05cfc 100644 (file)
@@ -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();
index 5f0067d..25de1a3 100644 (file)
@@ -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
index b33cd24..cd0867d 100644 (file)
@@ -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() );