From: C. Scott Ananian Date: Thu, 18 Oct 2018 16:01:23 +0000 (-0400) Subject: Follow up to 'Remove support for the deprecated Key header' X-Git-Tag: 1.34.0-rc.0~1278^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=73ec2a18361abfed98316f52c544f338d30cd255;p=lhc%2Fweb%2Fwiklou.git Follow up to 'Remove support for the deprecated Key header' Clean up a few more code paths and documentation bits left behind by Ia53d07cd8ce8ab1497294ea244c13c7499f632c7. Change-Id: I2bb1749c45bb79b27c5a3b2e1b8ed3395e8c11e0 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index fba75ecf50..4977a26a98 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() );