Page MenuHomePhabricator

Undefined index: showDimensions in /srv/mediawiki/php-1.30.0-wmf.6/includes/gallery/ImageGalleryBase.php on line 144
Closed, ResolvedPublicPRODUCTION ERROR

Description

these are spamming the hhvm log in production

Jun 20 22:18:48 mw1251:  #012
  Notice: Undefined index: showDimensions in /srv/mediawiki/php-1.30.0-wmf.6/includes/gallery/ImageGalleryBase.php on line 144
Jun 20 22:18:48 mw1251:  [Tue Jun 20 22:18:48 2017][] \n
  Notice: Undefined index: showDimensions in /srv/mediawiki/php-1.30.0-wmf.6/includes/gallery/ImageGalleryBase.php on line 144

Introduced by:

Revisions and Commits

Event Timeline

This looks like it was caused by a config change of some sort?

I'm not sure where ImageGallery gets it's config from but it's a missing index from the value returned by $this->getConfig():

/**
 * Create a new image gallery object.
 *
 * You should not call this directly, but instead use
 * ImageGalleryBase::factory().
 * @param string $mode
 * @param IContextSource|null $context
 */
function __construct( $mode = 'traditional', IContextSource $context = null ) {
	if ( $context ) {
		$this->setContext( $context );
	}
	$galleryOptions = $this->getConfig()->get( 'GalleryOptions' );
	$this->mImages = [];
	$this->mShowBytes = $galleryOptions['showBytes'];
	$this->mShowDimensions = $galleryOptions['showDimensions']; // <<<------ Error occurs here
	$this->mShowFilename = true;
	$this->mParser = false;
	$this->mHideBadImages = false;
	$this->mPerRow = $galleryOptions['imagesPerRow'];
	$this->mWidths = $galleryOptions['imageWidth'];
	$this->mHeights = $galleryOptions['imageHeight'];
	$this->mCaptionLength = $galleryOptions['captionLength'];
	$this->mMode = $mode;
}

Most likely wmf-config sets the array in its entirely instead of just changing individual array keys. Depending on what we've encouraged in the past for this configuration setting, we may need to support this by moving the defaults to Setup.php or TraditionalImageGallery.php. e.g. by merging (adding) the defaults at run-time instead. We do this for several other settings already and tends to scale better as a result. Less error prone, and easier to extend in the future, for precisely this reason.

@Krinkle: thanks, that does sound like the most robust way to handle it.

Stashbot subscribed.

Mentioned in SAL (#wikimedia-operations) [2017-06-21T19:30:09Z] <twentyafterfour> The train for wmf.6 (T167535) is currently blocked by T168479

Change 360694 had a related patch set uploaded (by 20after4; owner: 20after4):
[mediawiki/core@master] Check for unset index $galleryOptions['showDimensions']

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

Change 360695 had a related patch set uploaded (by 20after4; owner: 20after4):
[mediawiki/core@wmf/1.30.0-wmf.6] Check for unset index $galleryOptions['showDimensions']

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

Change 360694 abandoned by 20after4:
Check for unset index $galleryOptions['showDimensions']

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

Change 360695 merged by jenkins-bot:
[mediawiki/core@wmf/1.30.0-wmf.6] Check for unset index $galleryOptions['showDimensions']

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

Mentioned in SAL (#wikimedia-operations) [2017-06-21T20:14:57Z] <twentyafterfour@tin> Synchronized php-1.30.0-wmf.6/includes/gallery/ImageGalleryBase.php: deploy https://gerrit.wikimedia.org/r/#/c/360695/ refs T168479 to unblock the train (duration: 00m 56s)

This is patched in production but still broken in master, we need this fixed before wmf.7

Change 360694 restored by Bartosz Dziewoński:
Check for unset index $galleryOptions['showDimensions']

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

Change 360694 abandoned by Bartosz Dziewoński:
Check for unset index $galleryOptions['showDimensions']

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

Change 361054 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/core@master] Set $wgGalleryOptions in Setup.php

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

Change 361054 merged by jenkins-bot:
[mediawiki/core@master] Set $wgGalleryOptions in Setup.php

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

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