Page MenuHomePhabricator

ReleaseNotesBot no longer posting deploy notes
Closed, ResolvedPublic

Description

Guess the deprecation change somehow made releasenotesbot unhappy.

The only indication that something went wrong in the logs is:

PHP Warning: Illegal string offset 'csrftoken' in /srv/workspace/release/make-deploy-notes/botclasses.php on line 465

But release notes bot didn't post on Tuesday: https://www.mediawiki.org/wiki/Special:Contributions/ReleaseNotesBot

Event Timeline

The new API query is correct... https://en.wikipedia.org/w/api.php?action=query&meta=tokens&type=csrf&format=phpfm (added fm to get HTML formatted)

The loop is kinda superfluous, but was there before... This will work fine too

return $x['query']['tokens']['csrftoken'] ?? '';

php > $text = 'a:2:{s:13:"batchcomplete";s:0:"";s:5:"query";a:1:{s:6:"tokens";a:1:{s:9:"csrftoken";s:42:"<REDACTED>+\";}}}';
php > var_dump( unserialize( $text ) ) ;
array(2) {
  ["batchcomplete"]=>
  string(0) ""
  ["query"]=>
  array(1) {
    ["tokens"]=>
    array(1) {
      ["csrftoken"]=>
      string(42) "<REDACTED>+\"
    }
  }
}
php > var_dump( unserialize( $text )['query'] ) ;
array(1) {
  ["tokens"]=>
  array(1) {
    ["csrftoken"]=>
    string(42) "<REDACTED>+\"
  }
}
php > var_dump( unserialize( $text )['query']['tokens'] ) ;
array(1) {
  ["csrftoken"]=>
  string(42) "<REDACTED>+\"
}
php > var_dump( unserialize( $text )['query']['tokens']['csrftoken'] ) ;
string(42) "<REDACTED>+\"

The query will even work on logged out users... So it seems very odd. Unless it managed to get some sort of actual proper error...

Error handling is basic at best, but it is supposed to retry and eventually throw an exception after 10 turns

The loop is kinda superfluous, but was there before...

Previously the loop was iterating over "pages", where each page had a token in its array.

Now, the loop is iterating over tokens which is [ 'csrftoken' => 'sometokenhere' ], and so it is trying to access:

"sometokenhere"['csrftoken']

... which is an invalid string offset.

Change 709792 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/tools/release@master] Fix make-deploy-notes token fetching

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

Change 709792 merged by jenkins-bot:

[mediawiki/tools/release@master] Fix make-deploy-notes token fetching

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

Reedy claimed this task.