Page MenuHomePhabricator

UploadVerifyUploadHook::onUploadVerifyUpload docs is misleading - $pageText may be false instead of string
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Implement hook onUploadVerifyUpload handler that throws when $pageText is not a string type
  • Reupload image via Special:Upload
  • Hook is triggered and exception is thrown

What happens?:
When reuploading file to onUploadVerifyUpload hook is passed false in $pageText - related to phpdocs it always should be a string.

What should have happened instead?:
$pageText passed to onUploadVerifyUpload is always a string

Software version (skip for WMF-hosted wikis like Wikipedia):
MW 1.37 and higher

Additional notes
false is assigned to $pageText in here: https://github.com/wikimedia/mediawiki/blob/e1e74dd270d38cc966480cceb8262061d811aed5/includes/specials/SpecialUpload.php#L587-L592