Page MenuHomePhabricator

Fatal error on file upload: "Argument to AbuseFilter::filterAction() must be Title, null given"
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Request ID: W9S-wgpAMFsAAFu@MjoAAAAJ

message
PHP Fatal Error: Argument 2 passed to AbuseFilter::filterAction() must be an instance of Title, null given
trace
#0 /srv/mediawiki/php-1.33.0-wmf.1/extensions/AbuseFilter/includes/AbuseFilterHooks.php(823): NO_FUNCTION_GIVEN()
#1 /srv/mediawiki/php-1.33.0-wmf.1/extensions/AbuseFilter/includes/AbuseFilterHooks.php(746): AbuseFilterHooks::filterUpload(string, UploadFromFile, User, array, NULL, NULL, NULL)
#2 /srv/mediawiki/php-1.33.0-wmf.1/includes/Hooks.php(174): AbuseFilterHooks::onUploadStashFile(UploadFromFile, User, array, NULL)
#3 /srv/mediawiki/php-1.33.0-wmf.1/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#4 /srv/mediawiki/php-1.33.0-wmf.1/includes/upload/UploadBase.php(1084): Hooks::run(string, array)
#5 /srv/mediawiki/php-1.33.0-wmf.1/includes/upload/UploadBase.php(1064): UploadBase->runUploadStashFileHook(User)
#6 /srv/mediawiki/php-1.33.0-wmf.1/includes/specials/SpecialUpload.php(344): UploadBase->tryStashFile(User)
#7 /srv/mediawiki/php-1.33.0-wmf.1/includes/specials/SpecialUpload.php(697): SpecialUpload->showRecoverableUploadError(string)
#8 /srv/mediawiki/php-1.33.0-wmf.1/includes/specials/SpecialUpload.php(505): SpecialUpload->processVerificationError(array)
#9 /srv/mediawiki/php-1.33.0-wmf.1/includes/specials/SpecialUpload.php(207): SpecialUpload->processUpload()
#10 /srv/mediawiki/php-1.33.0-wmf.1/includes/specialpage/SpecialPage.php(569): SpecialUpload->execute(NULL)
#11 /srv/mediawiki/php-1.33.0-wmf.1/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)
#12 /srv/mediawiki/php-1.33.0-wmf.1/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#13 /srv/mediawiki/php-1.33.0-wmf.1/includes/MediaWiki.php(860): MediaWiki->performRequest()
#14 /srv/mediawiki/php-1.33.0-wmf.1/includes/MediaWiki.php(517): MediaWiki->main()
#15 /srv/mediawiki/php-1.33.0-wmf.1/index.php(42): MediaWiki->run()

Impact

Fatal error when a user tried to upload a file to Wikimedia Commons.

Notes

Started shortly after the deployment of 1.33-wmf1.

Looks similar to an issue seen on 1.32-wmf.26 that was seemingly fixed for several weeks.

Event Timeline

Krinkle triaged this task as High priority.Oct 27 2018, 7:52 PM
Krinkle created this task.

Short-term solution could be to remove the Title typehint from $title (which was added in https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/460335/). However, it wouldn't actually do much, since our code isn't really meant to handle filtering without a title.
Proper and long-term solution is to ensure filtering only happens with a real title. This may be done either by halting AF execution if the title is null, or changing the used hook to make sure it always passes a title. Anyway, this only happens with uploads, and I guess only for uploads where an invalid title is specified.
See T144265 (and related patches) for the progress in the long-term.

Change 472096 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/AbuseFilter@master] Revert "Remove some $wgUser usage"

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

@Daimona This is still one of the most common fatal errors, presumably responsible for edits and/or uploads by users wrongly being aborted or prevented. Can you confirm that the patch causing it can be cleanly reverted and/or submit an alternate patch that I can review instead?

@Krinkle AFAICS The fatal only happens for uploads, specifically for uploads where the specified title isn't valid. As I was saying above, avoiding the fatal doesn't avoid silent errors, but I agree that it'd be less intrusive for users. I can't send a patch right now, but the one above is definitely an overkill. All we need to do is remove the "Title" typehint from line 1100. Also, could you please take a look at https://gerrit.wikimedia.org/r/466842?

Change 472127 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Remove typehint to avoid fatal error

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

Change 472096 abandoned by Daimona Eaytoy:
Revert "Remove some $wgUser usage"

Reason:
Superseded by I0fdda51010243690ff3806c16d4e203c9ccd8e0a

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

Change 472246 had a related patch set uploaded (by Krinkle; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@wmf/1.33.0-wmf.3] Remove typehint to avoid fatal error

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

Change 472252 had a related patch set uploaded (by Krinkle; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@wmf/1.33.0-wmf.2] Remove typehint to avoid fatal error

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

Change 472127 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Remove typehint to avoid fatal error

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

Change 472246 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@wmf/1.33.0-wmf.3] Remove typehint to avoid fatal error

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

Mentioned in SAL (#wikimedia-operations) [2018-11-07T21:06:58Z] <krinkle@deploy1001> Synchronized php-1.33.0-wmf.3/extensions/AbuseFilter/includes/AbuseFilter.php: T208144 - I0fdda51010243 (duration: 00m 53s)

Change 472252 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@wmf/1.33.0-wmf.2] Remove typehint to avoid fatal error

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

Mentioned in SAL (#wikimedia-operations) [2018-11-07T21:18:56Z] <krinkle@deploy1001> Synchronized php-1.33.0-wmf.2/extensions/AbuseFilter/includes/AbuseFilter.php: T208144 - I0fdda510102436 (duration: 00m 53s)

Krinkle claimed this task.
Krinkle removed a project: Patch-For-Review.

Thanks!

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:08 PM