Page MenuHomePhabricator

Invalid argument supplied for foreach all over MassMessageListContent
Closed, ResolvedPublicPRODUCTION ERROR

Description

Spotted in production:

Warning: Invalid argument supplied for foreach() in /srv/mediawiki/php-1.29.0-wmf.19/extensions/MassMessage/includes/content/MassMessageListContent.php on line 186
Warning: Invalid argument supplied for foreach() in /srv/mediawiki/php-1.29.0-wmf.19/extensions/MassMessage/includes/content/MassMessageListContent.php on line 288
Warning: Invalid argument supplied for foreach() in /srv/mediawiki/php-1.29.0-wmf.19/extensions/MassMessage/includes/content/MassMessageListContent.php on line 90

Event Timeline

Legoktm added a subscriber: Legoktm.
	/**
	 * @return array|null
	 */
	public function getTargets() {
		$this->decode();
		return $this->targets;
	}

This warning happens if decoding fails and ->targets is null. We should just always have it be an array. Marking as easy, this is a good outreachy microtask.

Change 384199 had a related patch set uploaded (by Noella94; owner: Noella94):
[mediawiki/extensions/MassMessage@master] Invalid argument supplied for foreach all over MassMessageListContent

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

Change 384199 merged by jenkins-bot:
[mediawiki/extensions/MassMessage@master] Invalid argument supplied for foreach all over MassMessageListContent

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

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