Page MenuHomePhabricator

TypeError: Argument 1 passed to RevisionReviewForm::setTag() must be of the type int, null given, called in /srv/mediawiki/php-1.41.0-wmf.25/extensions/FlaggedRevs/frontend/specialpages/actions/RevisionReview.php on line 287
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   TypeError: Argument 1 passed to RevisionReviewForm::setTag() must be of the type int, null given, called in /srv/mediawiki/php-1.41.0-wmf.25/extensions/FlaggedRevs/frontend/specialpages/actions/RevisionReview.php on line 287
error.stack_trace
from /srv/mediawiki/php-1.41.0-wmf.25/extensions/FlaggedRevs/business/RevisionReviewForm.php(152)
#0 /srv/mediawiki/php-1.41.0-wmf.25/extensions/FlaggedRevs/frontend/specialpages/actions/RevisionReview.php(287): RevisionReviewForm->setTag(NULL)
#1 /srv/mediawiki/php-1.41.0-wmf.25/extensions/FlaggedRevs/rest/ReviewHandler.php(25): RevisionReview::doReview(array)
#2 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/SimpleHandler.php(38): MediaWiki\Extension\FlaggedRevs\Rest\ReviewHandler->run(string)
#3 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Router.php(517): MediaWiki\Rest\SimpleHandler->execute()
#4 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Router.php(422): MediaWiki\Rest\Router->executeHandler(MediaWiki\Extension\FlaggedRevs\Rest\ReviewHandler)
#5 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/EntryPoint.php(195): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#6 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#7 /srv/mediawiki/php-1.41.0-wmf.25/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#8 /srv/mediawiki/w/rest.php(3): require(string)
#9 {main}
Impact

FlaggedRevs is probably broken as a result, I rolled back 1.41.0-wmf.25 from group 2 wikis.

Notes

Several occurences happened immediately after promoting all wikis to 1.41.0-wmf.25

Details

MediaWiki Version
1.41.0-wmf.25
Request URL
https://de.wikipedia.org/w/rest.php/flaggedrevs/internal/review/Hans-Ulrich_Klose

Event Timeline

hashar triaged this task as Unbreak Now! priority.Sep 7 2023, 8:32 AM
hashar created this task.

I’m not sure yet how it came to be, but I think the following should unblock the train:

diff --git a/business/RevisionReviewForm.php b/business/RevisionReviewForm.php
index b4dffab2..923c213b 100644
--- a/business/RevisionReviewForm.php
+++ b/business/RevisionReviewForm.php
@@ -149,7 +149,7 @@ class RevisionReviewForm extends FRGenericSubmitForm {
                $this->setTag( (int)$value );
        }
 
-       public function setTag( int $value ): void {
+       public function setTag( ?int $value ): void {
                if ( !FlaggedRevs::useOnlyIfProtected() ) {
                        $this->trySet( $this->tag, $value );
                }

as $this->tag is already typed ?int.

Possibly from RevisionReview::doReview(). If you make the patch, I'll review it.

If you get a patch approved in master I am happy to do the cherry-pick to wmf/1.41.0-wmf.25 get it deployed and then rolling group2 again. You can add me as a reviewer in Gerrit via hashar.

Change 955672 had a related patch set uploaded (by Tacsipacsi; author: Tacsipacsi):

[mediawiki/extensions/FlaggedRevs@master] RevisionReviewForm: allow setting `null` tag

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

Change 955062 had a related patch set uploaded (by Ladsgroup; author: Tacsipacsi):

[mediawiki/extensions/FlaggedRevs@wmf/1.41.0-wmf.25] RevisionReviewForm: allow setting `null` tag

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

Change 955672 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@master] RevisionReviewForm: allow setting `null` tag

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

Change 955062 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@wmf/1.41.0-wmf.25] RevisionReviewForm: allow setting `null` tag

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

Mentioned in SAL (#wikimedia-operations) [2023-09-07T09:46:16Z] <hashar@deploy1002> Started scap: Backport for [[gerrit:955062|RevisionReviewForm: allow setting null tag (T345804)]]

Mentioned in SAL (#wikimedia-operations) [2023-09-07T09:47:56Z] <hashar@deploy1002> ladsgroup and hashar: Backport for [[gerrit:955062|RevisionReviewForm: allow setting null tag (T345804)]] synced to the testservers mwdebug2001.codfw.wmnet, mwdebug2002.codfw.wmnet, mwdebug1001.eqiad.wmnet, mwdebug1002.eqiad.wmnet, and mw-debug kubernetes deployment (accessible via k8s-experimental XWD option)

Mentioned in SAL (#wikimedia-operations) [2023-09-07T09:54:08Z] <hashar@deploy1002> Finished scap: Backport for [[gerrit:955062|RevisionReviewForm: allow setting null tag (T345804)]] (duration: 07m 54s)

hashar assigned this task to Tacsipacsi.

I have deployed the backport and promoted all wikis to 1.41.0-wmf.25. I will reopen if there is still an issue.

Copy pasting my comment from my comment on the change:

Looking at calls made to setTag() they all use an int (by casting a boolean to an int).

There is one exception in frontend/specialpages/actions/RevisionReview.php:

231     public static function doReview( $argsMap ) { 
 
286                 case 'wp' . FlaggedRevs::getTagName():
287                     $form->setTag( $val );
288                     break;
289             }

I guess that $form->setTag() should cast the $val to an integer (so that when it is null it becomes an int(0))?