Page MenuHomePhabricator

[Merge blocker] mwext-php72-phan-docker: Argument 2 ($deleter) is false of type false but \WikiPage::doDeleteArticleReal() takes \User
Closed, ResolvedPublic

Description

https://integration.wikimedia.org/ci/job/mwext-php72-phan-docker/73344/console

10:22:18 <checkstyle version="6.5">
10:22:18   <file name="specials/SpecialManageTranslatorSandbox.php">
10:22:18     <error line="67" severity="error" message="Argument 2 ($deleter) is false of type false but \WikiPage::doDeleteArticleReal() takes \User defined at ../../includes/page/WikiPage.php:2737" source="PhanTypeMismatchArgumentReal"/>
10:22:18   </file>
10:22:18   <file name="tag/TranslateDeleteJob.php">
10:22:18     <error line="66" severity="error" message="Argument 2 ($deleter) is false of type false but \WikiPage::doDeleteArticleReal() takes \User defined at ../../includes/page/WikiPage.php:2737" source="PhanTypeMismatchArgumentReal"/>
10:22:18   </file>
10:22:18 </checkstyle>

The code in question is:

59         protected function deleteUserPage( $user ) {
60                 $userpage = WikiPage::factory( $user->getUserPage() );
61                 if ( $userpage->exists() ) {
62                         $reason = wfMessage( 'tsb-delete-userpage-summary' )->inContentLanguage()->text();
63                         if ( version_compare( MW_VERSION, '1.35', '<' ) ) {
64                                 $dummyError = '';
65                                 $userpage->doDeleteArticleReal(
66                                         $reason,
67                                         false,
68                                         0,
69                                         true,
70                                         $dummyError,
71                                         $this->getUser()
72                                 );
73                         } else {
74                                 $userpage->doDeleteArticleReal( $reason, $this->getUser() );
75                         }
76                 }
77         }

Not how we cannot pass $user on line 67 because in MW 1.34 the parameter does something else:

	/**
	 * Same as doDeleteArticleReal(), but returns a simple boolean. This is kept around for
	 * backwards compatibility, if you care about error reporting you should use
	 * doDeleteArticleReal() instead.
	 *
	 * Deletes the article with database consistency, writes logs, purges caches
	 *
	 * @param string $reason Delete reason for deletion log
	 * @param bool $suppress Suppress all revisions and log the deletion in
	 *        the suppression log instead of the deletion log
	 * @param int|null $u1 Unused
	 * @param bool|null $u2 Unused
	 * @param array|string &$error Array of errors to append to
	 * @param User|null $user The deleting user
	 * @param bool $immediate false allows deleting over time via the job queue
	 * @return bool True if successful
	 * @throws FatalError
	 * @throws MWException
	 */
	public function doDeleteArticle(
		$reason, $suppress = false, $u1 = null, $u2 = null, &$error = '', User $user = null,
		$immediate = false
	) {
		$status = $this->doDeleteArticleReal( $reason, $suppress, $u1, $u2, $error, $user,
			[], 'delete', $immediate );

		// Returns true if the page was actually deleted, or is scheduled for deletion
		return $status->isOK();
	}

Outcome

A change in MediaWiki core caused all patches for Translate to fail code quality tests which effectively blocks merging all changes. The unavoidable test failures were suppressed.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMon, Sep 14, 8:37 AM
Nikerabbit triaged this task as Unbreak Now! priority.Mon, Sep 14, 8:42 AM
Nikerabbit updated the task description. (Show Details)

Change 627233 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/Translate@master] Suppress unavoidable Phan warnings

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

Nikerabbit updated the task description. (Show Details)Mon, Sep 14, 11:12 AM

Change 627233 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Suppress unavoidable Phan warnings

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

Nikerabbit closed this task as Resolved.Mon, Sep 14, 3:53 PM