diff --git a/RELEASE-NOTES-1.38 b/RELEASE-NOTES-1.38 index 846b10121eb..79cb6069f86 100644 --- a/RELEASE-NOTES-1.38 +++ b/RELEASE-NOTES-1.38 @@ -90,6 +90,9 @@ because of Phabricator reports. process. * The signature of PageUpdater::markAsRevert method was changed. It has never been used outside of MediaWiki core. +* If you want to use interwiki titles with HTMLTitleTextField, you now need + to pass 'interwiki' => true. In 1.37, the default behavior was to let + interwiki title through by default, logging a deprecation warning. * … === Deprecations in 1.38 === diff --git a/includes/htmlform/fields/HTMLTitleTextField.php b/includes/htmlform/fields/HTMLTitleTextField.php index 6e35bea0b29..e9e7df6f720 100644 --- a/includes/htmlform/fields/HTMLTitleTextField.php +++ b/includes/htmlform/fields/HTMLTitleTextField.php @@ -29,10 +29,7 @@ class HTMLTitleTextField extends HTMLTextField { 'relative' => false, 'creatable' => false, 'exists' => false, - // Default to null during the deprecation process so we can differentiate between - // callers who intentionally want to disallow interwiki titles and legacy callers - // who aren't aware of the setting. - 'interwiki' => null, + 'interwiki' => false, // This overrides the default from HTMLFormField 'required' => true, ]; @@ -71,20 +68,6 @@ class HTMLTitleTextField extends HTMLTextField { if ( $this->mParams['interwiki'] ) { // We cannot validate external titles, skip the rest of the validation return parent::validate( $value, $alldata ); - } elseif ( $this->mParams['interwiki'] === null ) { - // Legacy caller, they probably don't need/want interwiki titles as those don't - // make sense in most use cases. To avoid a B/C break without deprecation, though, - // we let the title through and raise a warning. That way, code that needs to allow - // interwiki titles will get deprecation warnings as long as users actually submit - // interwiki titles to the form. That's not ideal but a less conditional warning - // would be impractical - having to update every title field in the world to avoid - // warnings would be too much of a burden. - wfDeprecated( - __METHOD__ . ' will reject external titles in 1.38 when interwiki is false ' - . "(field: $this->mName)", - '1.37' - ); - return parent::validate( $value, $alldata ); } else { return $this->msg( 'htmlform-title-interwiki', $title->getPrefixedText() ); } diff --git a/tests/phpunit/integration/includes/htmlform/HTMLTitleTextFieldTest.php b/tests/phpunit/integration/includes/htmlform/HTMLTitleTextFieldTest.php index 007b7715689..8ee02e4a1a6 100644 --- a/tests/phpunit/integration/includes/htmlform/HTMLTitleTextFieldTest.php +++ b/tests/phpunit/integration/includes/htmlform/HTMLTitleTextFieldTest.php @@ -25,6 +25,7 @@ class HTMLTitleTextFieldTest extends MediaWikiIntegrationTestCase { public function provideInterwiki() { return [ 'local title' => [ [ 'interwiki' => false ], 'SomeTitle', true ], + 'interwiki title, default' => [ [], 'unittest_foo:SomeTitle', false ], 'interwiki title, disallowed' => [ [ 'interwiki' => false ], 'unittest_foo:SomeTitle', false ], 'interwiki title, allowed' => [ [ 'interwiki' => true ], @@ -50,12 +51,6 @@ class HTMLTitleTextFieldTest extends MediaWikiIntegrationTestCase { $field->validate( 'SomeTitle', [ 'foo' => 'SomeTitle' ] ); } - public function testInterwiki_deprecation() { - $this->expectError(); - $field = new HTMLTitleTextField( [ 'fieldname' => 'foo' ] ); - $field->validate( 'unittest_foo:SomeTitle', [ 'foo' => 'SomeTitle' ] ); - } - protected function setupInterwikiTable() { $site = new Site( Site::TYPE_MEDIAWIKI ); $site->setGlobalId( 'unittest_foowiki' );