Page MenuHomePhabricator

Invalid operand type was used: Invalid type used as key in ApiBase.php
Closed, DuplicatePublicPRODUCTION ERROR

Description

[XH3KgQpAEMYAAC5SkGkAAADP] /w/api.php   ErrorException from line 1808 of /srv/mediawiki/php-1.33.0-wmf.19/includes/api/ApiBase.php: PHP Warning: Invalid operand type was used: Invalid type used as key
#0 /srv/mediawiki/php-1.33.0-wmf.19/includes/api/ApiBase.php(1808): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.33.0-wmf.19/includes/api/ApiBase.php(2146): ApiBase->errorArrayToStatus(array, User)
#2 /srv/mediawiki/php-1.33.0-wmf.19/includes/api/ApiEditPage.php(121): ApiBase->checkTitleUserPermissions(Title, array, array)
#3 /srv/mediawiki/php-1.33.0-wmf.19/includes/api/ApiMain.php(1596): ApiEditPage->execute()
#4 /srv/mediawiki/php-1.33.0-wmf.19/includes/api/ApiMain.php(531): ApiMain->executeAction()
#5 /srv/mediawiki/php-1.33.0-wmf.19/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
#6 /srv/mediawiki/php-1.33.0-wmf.19/api.php(87): ApiMain->execute()
#7 /srv/mediawiki/w/api.php(3): include(string)
#8 {main}

The number of these errors increased a lot around 18:10 UTC today, not sure why

Event Timeline

Mentioned in SAL (#wikimedia-operations) [2019-03-05T01:15:39Z] <catrope@deploy1001> Synchronized php-1.33.0-wmf.19/includes/api/ApiBase.php: Logging live patch to debug T217615 (duration: 00m 49s)

Mentioned in SAL (#wikimedia-operations) [2019-03-05T01:18:14Z] <catrope@deploy1001> Synchronized php-1.33.0-wmf.19/includes/api/ApiBase.php: Logging live patch to debug T217615 (duration: 00m 47s)

Mentioned in SAL (#wikimedia-operations) [2019-03-05T01:21:40Z] <catrope@deploy1001> Synchronized php-1.33.0-wmf.19/includes/api/ApiBase.php: Logging live patch to debug T217615 (duration: 00m 47s)

Mentioned in SAL (#wikimedia-operations) [2019-03-05T01:32:59Z] <catrope@deploy1001> Synchronized php-1.33.0-wmf.19/includes/api/ApiBase.php: Logging live patch to debug T217615 (duration: 00m 47s)

Mentioned in SAL (#wikimedia-operations) [2019-03-05T02:05:55Z] <catrope@deploy1001> Synchronized php-1.33.0-wmf.19/includes/api/ApiBase.php: Logging live patch to debug T217615 (duration: 00m 47s)

One of the elements of the $errors array is itself an array with one element, which is an ApiMessage object. This object is generated by TitleBlacklist here. I'm still trying to figure out why it's wrapped in an array twice.

Looks like it's already double-wrapped when it comes from getUserPermissionsErrors():

catrope@mwmaint1002:~$ mwscript eval.php mswiki
> $title = Title::newFromText('Perbincangan pengguna:Նարեկ Տիտանյան');
> $errors = $title->getUserPermissionsErrors('create', User::newFromName('Catrope'));
> var_dump($errors);
array(1) {
  [0]=>
  array(1) {
    [0]=>
    object(ApiMessage)#1884 (12) {
      ["apiCode":protected]=>
      string(24) "titleblacklist-forbidden"
      ["apiData":protected]=>
      array(3) {
        ["message"]=>
        array(2) {
          ["key"]=>
          string(29) "titleblacklist-forbidden-edit"
          ["params"]=>
          array(3) {
            [0]=>
            string(110) " (?!(User|Wikipedia|File)( talk)?:|Talk:)\P{L}*[^\p{Armenian}\P{L}].*\p{Armenian}.* # Armenian + anything else"
            [1]=>
            string(49) "Perbincangan pengguna:Նարեկ Տիտանյան"
            ["_element"]=>
            string(5) "param"
          }
        }
        ["line"]=>
        string(110) " (?!(User|Wikipedia|File)( talk)?:|Talk:)\P{L}*[^\p{Armenian}\P{L}].*\p{Armenian}.* # Armenian + anything else"
        ["info"]=>
        string(53) "TitleBlacklist prevents this title from being created"
      }
      ["interface":protected]=>
      bool(true)
      ["language":protected]=>
      bool(false)
      ["key":protected]=>
      string(29) "titleblacklist-forbidden-edit"
      ["keysToTry":protected]=>
      array(1) {
        [0]=>
        string(29) "titleblacklist-forbidden-edit"
      }
      ["parameters":protected]=>
      array(2) {
        [0]=>
        string(110) " (?!(User|Wikipedia|File)( talk)?:|Talk:)\P{L}*[^\p{Armenian}\P{L}].*\p{Armenian}.* # Armenian + anything else"
        [1]=>
        string(49) "Perbincangan pengguna:Նարեկ Տիտանյան"
      }
      ["format":protected]=>
      string(5) "parse"
      ["useDatabase":protected]=>
      bool(true)
      ["title":protected]=>
      NULL
      ["content":protected]=>
      NULL
      ["message":protected]=>
      NULL
    }
  }
}

Mentioned in SAL (#wikimedia-operations) [2019-03-05T02:21:56Z] <catrope@deploy1001> Synchronized php-1.33.0-wmf.19/includes/api/ApiBase.php: Hot fix for T217615 (duration: 00m 47s)

Never mind, this was already found and fixed in T217382: APIEditPage -> ApiBase->checkTitleUserPermissions PHP Warning: Invalid operand type was used: Invalid type used as key. Somehow I didn't find that task when searching for existing tasks.

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