Page MenuHomePhabricator

Undefined index: hash in ComposerLock.php
Closed, ResolvedPublic

Description

reedy@ubuntu64-web-esxi:/var/www/wiki/mediawiki/core$ MW_INSTALL_PATH=/var/www/wiki/mediawiki/core php maintenance/update.php --quick
MediaWiki 1.28.0-alpha Updater

PHP Notice:  Undefined index: hash in /var/www/wiki/mediawiki/core/includes/libs/composer/ComposerLock.php on line 19
PHP Stack trace:
PHP   1. {main}() /var/www/wiki/mediawiki/core/maintenance/update.php:0
PHP   2. require_once() /var/www/wiki/mediawiki/core/maintenance/update.php:216
PHP   3. UpdateMediaWiki->execute() /var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:110
PHP   4. CheckComposerLockUpToDate->execute() /var/www/wiki/mediawiki/core/maintenance/update.php:135
PHP   5. ComposerLock->getHash() /var/www/wiki/mediawiki/core/maintenance/checkComposerLockUpToDate.php:37

Notice: Undefined index: hash in /var/www/wiki/mediawiki/core/includes/libs/composer/ComposerLock.php on line 19

Call Stack:
    0.0009     385928   1. {main}() /var/www/wiki/mediawiki/core/maintenance/update.php:0
    0.0129     634400   2. require_once('/var/www/wiki/mediawiki/core/maintenance/doMaintenance.php') /var/www/wiki/mediawiki/core/maintenance/update.php:216
    0.9695   14566488   3. UpdateMediaWiki->execute() /var/www/wiki/mediawiki/core/maintenance/doMaintenance.php:110
    0.9820   14887000   4. CheckComposerLockUpToDate->execute() /var/www/wiki/mediawiki/core/maintenance/update.php:135
    0.9869   15212400   5. ComposerLock->getHash() /var/www/wiki/mediawiki/core/maintenance/checkComposerLockUpToDate.php:37

Your composer.lock file is up to date with current dependencies!

Not sure where this is from... but probably wants to be looked at

Event Timeline

Hmm. Seems to be from https://github.com/wikimedia/mediawiki-vendor/commit/363f19e21b0390d2738edf7d6ea2b9becbb41d03

https://github.com/wikimedia/mediawiki-vendor/commit/363f19e21b0390d2738edf7d6ea2b9becbb41d03#diff-1da2c7edc898c70e5a79a9997c98ceccL7

Is this some recent composer change that it's not adding (or, removing, the hash)

reedy@ubuntu64-web-esxi:/var/www/wiki/mediawiki/core/vendor$ php /var/www/wiki/mediawiki/composer.phar --version
Composer version 1.3-dev (00c1b601c828ecc883c6bb61122a2055836bc43a) 2016-09-29 06:54:28

We probably need to re-implement Composer\Package\Locker::getContentHash() instead of using 'hash'.

Reedy triaged this task as Medium priority.Oct 15 2016, 7:33 PM

Was gonna drop this to Low, as it would be for WMF; we have to use Composer 1.0.x... But putting at normal, as joe bloggs downloading composer for his own install will grab the newest version unknowingly, so we should get it fixed... For REL1_27?

What's the difference between hash and content-hash?

content-hash is basically a fix for what we already worked around in checkComposerLockUpToDate.php:

			// The hash is the entire composer.json file,
			// so it can be updated without any of the dependencies changing
			// We couldn't find any out-of-date dependencies, so assume everything is ok!

I think we should just always compare the dependencies and get rid of hash checking, it's not going to make that much of a difference really.

Change 316243 had a related patch set uploaded (by Legoktm):
checkComposerLockUpToDate: Always check dependencies

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

Change 316243 merged by jenkins-bot:
checkComposerLockUpToDate: Always check dependencies

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

Change 316244 had a related patch set uploaded (by Reedy):
checkComposerLockUpToDate: Always check dependencies

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

Change 316244 merged by jenkins-bot:
checkComposerLockUpToDate: Always check dependencies

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