Merge "Remove wrapclass from parser cache key"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 2 Feb 2018 18:41:02 +0000 (18:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 2 Feb 2018 18:41:02 +0000 (18:41 +0000)
RELEASE-NOTES-1.31
includes/parser/ParserOptions.php
tests/phpunit/includes/parser/ParserOptionsTest.php

index ad24852..20bea0b 100644 (file)
@@ -196,6 +196,9 @@ changes to languages because of Phabricator reports.
   used for that. Rather, setRef() existed as memory optimisation for PHP 4.
 * Passing false to ParserOptions::setWrapOutputClass() is deprecated. Use the
   'unwrap' transform to ParserOutput::getText() instead.
+* ParserOutput objects generated using a non-default value for
+  ParserOptions::setWrapOutputClass() can no longer be added to the parser
+  cache.
 
 == Compatibility ==
 MediaWiki 1.31 requires PHP 5.5.9 or later. Although HHVM 3.18.5 or later is supported,
index 1405c45..ca8e739 100644 (file)
@@ -65,7 +65,6 @@ class ParserOptions {
                'stubthreshold' => true,
                'printable' => true,
                'userlang' => true,
-               'wrapclass' => true,
        ];
 
        /**
@@ -780,14 +779,17 @@ class ParserOptions {
        /**
         * CSS class to use to wrap output from Parser::parse()
         * @since 1.30
-        * @param string|bool $className Set false to disable wrapping.
-        *   Passing false is deprecated since MediaWiki 1.31
+        * @param string $className Class name to use for wrapping.
+        *   Passing false to indicate "no wrapping" was deprecated in MediaWiki 1.31.
         * @return string|bool Current value
         */
        public function setWrapOutputClass( $className ) {
                if ( $className === true ) { // DWIM, they probably want the default class name
                        $className = 'mw-parser-output';
                }
+               if ( $className === false ) {
+                       wfDeprecated( __METHOD__ . '( false )', '1.31' );
+               }
                return $this->setOption( 'wrapclass', $className );
        }
 
index 232b0bb..d55372c 100644 (file)
@@ -21,7 +21,6 @@ class ParserOptionsTest extends MediaWikiTestCase {
                        'stubthreshold' => true,
                        'printable' => true,
                        'userlang' => true,
-                       'wrapclass' => true,
                ];
        }
 
@@ -67,6 +66,9 @@ class ParserOptionsTest extends MediaWikiTestCase {
                        'Non-in-key options are not ok' => [ false, [
                                'removeComments' => false,
                        ] ],
+                       'Non-in-key options are not ok (2)' => [ false, [
+                               'wrapclass' => 'foobar',
+                       ] ],
                        'Canonical override, not default (1)' => [ true, [
                                'tidy' => true,
                        ] ],
@@ -213,7 +215,7 @@ class ParserOptionsTest extends MediaWikiTestCase {
                $wgHooks['ParserOptionsRegister'] = [];
                $this->assertSame( [
                        'dateformat', 'numberheadings', 'printable', 'stubthreshold',
-                       'thumbsize', 'userlang', 'wrapclass',
+                       'thumbsize', 'userlang'
                ], ParserOptions::allCacheVaryingOptions() );
 
                self::clearCache();
@@ -231,7 +233,7 @@ class ParserOptionsTest extends MediaWikiTestCase {
                };
                $this->assertSame( [
                        'dateformat', 'foo', 'numberheadings', 'printable', 'stubthreshold',
-                       'thumbsize', 'userlang', 'wrapclass',
+                       'thumbsize', 'userlang'
                ], ParserOptions::allCacheVaryingOptions() );
        }