Page MenuHomePhabricator

Notice: Undefined index: 0 in /srv/mediawiki/php-1.27.0-wmf.9/extensions/MassMessage/includes/MassMessage.php on line 391
Closed, ResolvedPublicPRODUCTION ERROR

Description

seen in the logs:

Notice: Undefined index: 0 in /srv/mediawiki/php-1.27.0-wmf.9/extensions/MassMessage/includes/MassMessage.php on line 391

Event Timeline

aude created this task.Jan 11 2016, 6:07 PM
aude raised the priority of this task from to Needs Triage.
aude updated the task description. (Show Details)
aude added a subscriber: aude.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptJan 11 2016, 6:07 PM

Do we know what wiki this was on?

aude added a comment.Jan 11 2016, 7:24 PM

@Legoktm I don't know and don't think the logs provide this. (only know it's mw1242)

The code at time of the task creation is https://phabricator.wikimedia.org/diffusion/EMAM/browse/master/includes/MassMessage.php;ba5649a0216d497d05f9eebd821794875a0c57ec$391

In short terms:

$output .= preg_quote( $tzMatches[0] );

in getTimestampRegex() has an empty $tzMatches, because the return value of the preg_match filling the array is not checked.

Tagging Editing-team for Extension:MassMessage, per Developers/Maintainers.

Code is at: https://gerrit.wikimedia.org/g/mediawiki/extensions/MassMessage/+/ac737649dda4a1db9a7eec07d4821ab8cd5188e1/includes/MassMessage.php#299. Looks like it might be assuming something about user-signature timestamp formats that isn't true for some wikis or languages.

Checking Logstash, I found a handful of samples from last month, one included below:

exception_id: W2VxDApAMEoAAG30chUAAABR 
message: PHP Notice: Undefined index: 0
exception.trace:
#0 /srv/mediawiki/php-1.32.0-wmf.15/extensions/MassMessage/includes/MassMessage.php(306): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.32.0-wmf.15/includes/libs/objectcache/WANObjectCache.php(1242): Closure$MediaWiki\MassMessage\MassMessage::getTimestampRegex(boolean, integer, array, NULL)
#2 /srv/mediawiki/php-1.32.0-wmf.15/includes/libs/objectcache/WANObjectCache.php(1115): WANObjectCache->doGetWithSetCallback(string, integer, Closure$MediaWiki\MassMessage\MassMessage::getTimestampRegex;1833, array)
#3 /srv/mediawiki/php-1.32.0-wmf.15/extensions/MassMessage/includes/MassMessage.php(314): WANObjectCache->getWithSetCallback(string, integer, Closure$MediaWiki\MassMessage\MassMessage::getTimestampRegex;1833)
#4 /srv/mediawiki/php-1.32.0-wmf.15/extensions/MassMessage/includes/SpecialMassMessage.php(333): MediaWiki\MassMessage\MassMessage::getTimestampRegex()
#5 /srv/mediawiki/php-1.32.0-wmf.15/extensions/MassMessage/includes/SpecialMassMessage.php(206): MediaWiki\MassMessage\SpecialMassMessage->preview(array)
#6 /srv/mediawiki/php-1.32.0-wmf.15/includes/htmlform/HTMLForm.php(662): MediaWiki\MassMessage\SpecialMassMessage->callback(array, HTMLForm)
#7 /srv/mediawiki/php-1.32.0-wmf.15/includes/htmlform/HTMLForm.php(554): HTMLForm->trySubmit()
#8 /srv/mediawiki/php-1.32.0-wmf.15/extensions/MassMessage/includes/SpecialMassMessage.php(89): HTMLForm->tryAuthorizedSubmit()
#9 /srv/mediawiki/php-1.32.0-wmf.15/includes/specialpage/SpecialPage.php(566): MediaWiki\MassMessage\SpecialMassMessage->execute(NULL)
#10 /srv/mediawiki/php-1.32.0-wmf.15/includes/specialpage/SpecialPageFactory.php(569): SpecialPage->run(NULL)
#11 /srv/mediawiki/php-1.32.0-wmf.15/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#12 /srv/mediawiki/php-1.32.0-wmf.15/includes/MediaWiki.php(867): MediaWiki->performRequest()
#13 /srv/mediawiki/php-1.32.0-wmf.15/includes/MediaWiki.php(524): MediaWiki->main()
#14 /srv/mediawiki/php-1.32.0-wmf.15/index.php(42): MediaWiki->run()

Change 453534 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/MassMessage@master] Check return of preg_match before processing matches

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

6 wikis may affected, because there are using customized timezones:

  • urwikiquote: [میڈیاویکی:Timezone-utc]
  • arwiki: [ميدياويكي:Timezone-utc]
  • pswiki: [ميډياويکي:Timezone-utc]
  • urwiki: [میڈیاویکی:Timezone-utc]
  • alswiki: [MediaWiki:Timezone-cest, MediaWiki:Timezone-cet]
  • dewiktionary: [MediaWiki:Timezone-cest, MediaWiki:Timezone-cet]

arwiki is using non-latin letters which not matching \w in the regex:
https://ar.wikipedia.org/wiki/%D9%85%D9%8A%D8%AF%D9%8A%D8%A7%D9%88%D9%8A%D9%83%D9%8A:Timezone-utc

My patch set only avoids the notice, but I have no idea if the exception some lines later may trigger

Change 453534 merged by jenkins-bot:
[mediawiki/extensions/MassMessage@master] Check return of preg_match before processing matches

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

Umherirrender closed this task as Resolved.Aug 31 2018, 6:41 PM
Umherirrender claimed this task.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:11 PM