Page MenuHomePhabricator

PHP Deprecated: Use of HTMLTitleTextField::validate will reject external titles in 1.38 when interwiki is false (field: wpSearchTitle) was deprecated in MediaWiki 1.37. [Called from HTMLFormField::getErrorsRaw]
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Deprecated: Use of HTMLTitleTextField::validate will reject external titles in 1.38 when interwiki is false (field: wpSearchTitle) was deprecated in MediaWiki 1.37. [Called from HTMLFormField::getErrorsRaw]
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/HTMLFormField.php(940)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, string, array)
#1 /srv/mediawiki/php-1.37.0-wmf.16/includes/debug/MWDebug.php(376): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.37.0-wmf.16/includes/debug/MWDebug.php(352): MWDebug::sendRawDeprecated(string, boolean, string)
#3 /srv/mediawiki/php-1.37.0-wmf.16/includes/debug/MWDebug.php(230): MWDebug::deprecatedMsg(string, string, string, integer)
#4 /srv/mediawiki/php-1.37.0-wmf.16/includes/GlobalFunctions.php(998): MWDebug::deprecated(string, string, string, integer)
#5 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/fields/HTMLTitleTextField.php(75): wfDeprecated(string, string)
#6 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/HTMLFormField.php(940): HTMLTitleTextField->validate(string, array)
#7 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/HTMLFormField.php(630): HTMLFormField->getErrorsRaw(string)
#8 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/HTMLForm.php(1748): HTMLFormField->getOOUI(string)
#9 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/HTMLForm.php(1323): HTMLForm->displaySection(array, string)
#10 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/OOUIHTMLForm.php(279): HTMLForm->getBody()
#11 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/HTMLForm.php(1107): OOUIHTMLForm->getBody()
#12 /srv/mediawiki/php-1.37.0-wmf.16/includes/htmlform/HTMLForm.php(1079): HTMLForm->getHTML(boolean)
#13 /srv/mediawiki/php-1.37.0-wmf.16/extensions/AbuseFilter/includes/Special/SpecialAbuseLog.php(386): HTMLForm->displayForm(boolean)
#14 /srv/mediawiki/php-1.37.0-wmf.16/extensions/AbuseFilter/includes/Special/SpecialAbuseLog.php(214): MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseLog->searchForm()
#15 /srv/mediawiki/php-1.37.0-wmf.16/includes/specialpage/SpecialPage.php(646): MediaWiki\Extension\AbuseFilter\Special\SpecialAbuseLog->execute(NULL)
#16 /srv/mediawiki/php-1.37.0-wmf.16/includes/specialpage/SpecialPageFactory.php(1365): SpecialPage->run(NULL)
#17 /srv/mediawiki/php-1.37.0-wmf.16/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#18 /srv/mediawiki/php-1.37.0-wmf.16/includes/MediaWiki.php(925): MediaWiki->performRequest()
#19 /srv/mediawiki/php-1.37.0-wmf.16/includes/MediaWiki.php(559): MediaWiki->main()
#20 /srv/mediawiki/php-1.37.0-wmf.16/index.php(53): MediaWiki->run()
#21 /srv/mediawiki/php-1.37.0-wmf.16/index.php(46): wfIndexMain()
#22 /srv/mediawiki/w/index.php(3): require(string)
#23 {main}
Impact

deprecation warning in production code. Blocking 1.38.0-wmf.18

Notes

Details

Request URL
https://meta.wikimedia.org/wiki/Special:AbuseLog?wpSearchUser=*&wpSearchPeriodStart=*&wpSearchPeriodEnd=*&wpSearchTitle=*&wpSearchImpact=*&wpSearchAction=*&wpSearchActionTaken=*&wpSearchFilter=*&wpSearchWiki=*

Event Timeline

mmodell triaged this task as High priority.Aug 4 2021, 6:56 PM
mmodell created this task.
Urbanecm added subscribers: Daimona, Tgr, Urbanecm.

So, this is a "special" deprecation warning (introduced by me and @Tgr). Its purpose is to inform code owners that someone tried to add an interwiki link to a form field without the form allowing it (by specifying 'interwiki' => true in the form specification).

With/after 1.38, the code in question will treat those interwiki titles as invalid. This gives code maintainers some grace period.

Unfortunately, it cannot really be "fixed" if the form should NOT support interwiki titles, hence I don't think it should block a train.

@Daimona I think the form at https://meta.wikimedia.org/wiki/Special:AbuseLog should not allow users to specify titles at other wikis, right?

Updating tags to reflect reality.

I suppose we could make interwiki default to null, so you can set it to false to avoid this warning, and null would behave the same as false but trigger the warning.

Krinkle added a subscriber: Krinkle.

Ack, thanks for clarifying. These are non-trivial to find through codesearch, hence we're using hard-deprecation right away so as to find usage and easily determine where it's likely common/intentional vs rare/unintentional.

We can filter these out on the dashboard for a while, no problem.

Indeed, per @Tgr, I'd recommend allowing opt-in/opt-out in both directions so that for cases where you know what you want you don't have to wait for the end of the deprecation before the warning goes away.

Change 710133 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/core@master] Make HTMLTitleTextField interwiki option tri-state

https://gerrit.wikimedia.org/r/710133

Change 710081 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/AbuseFilter@master] Disallow interwiki on Special:AbuseLog

https://gerrit.wikimedia.org/r/710081

@Daimona I think the form at https://meta.wikimedia.org/wiki/Special:AbuseLog should not allow users to specify titles at other wikis, right?

I think for the future, it might make sense to have this feature, so one can search for global AF hits on another wiki. However, the current code doesn't support interwikis in the wpSearchTitle field (and foreign titles are also stored without the namespace in the abuse_filter_log table), so it makes sense to disable for now.

@Daimona I think the form at https://meta.wikimedia.org/wiki/Special:AbuseLog should not allow users to specify titles at other wikis, right?

I think for the future, it might make sense to have this feature, so one can search for global AF hits on another wiki. However, the current code doesn't support interwikis in the wpSearchTitle field (and foreign titles are also stored without the namespace in the abuse_filter_log table), so it makes sense to disable for now.

Thanks for clarifying. Approved both patches. However, I just noticed that Special:AbuseLog fails to inform users about invalid input, and processes it regardless. Not sure if that's intentional -- happy to file as a task if not.

Change 710133 merged by jenkins-bot:

[mediawiki/core@master] Make HTMLTitleTextField interwiki option tri-state

https://gerrit.wikimedia.org/r/710133

Change 710081 merged by jenkins-bot:

[mediawiki/extensions/AbuseFilter@master] Disallow interwiki on Special:AbuseLog

https://gerrit.wikimedia.org/r/710081

I think this can be safely closed for now. The very specific error listed in this task's description does not happen anymore because of the two patches above. T288181 is a followup to this task, which is currently stalled (and will become unblocked with 1.37 released).

If anyone sees anything else to do here, feel free to reopen.