Page MenuHomePhabricator

TemplateStyles on REL1_42 causing issues with scoped-callback v5 which is incompatible with 1.42
Closed, ResolvedPublicBUG REPORT

Description

Multiple reports of

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Wikimedia\ScopedCallback::consume(), 0 passed in /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php on line 461 and exactly 1 expected in /var/www/html/extensions/TemplateStyles/vendor/wikimedia/scoped-callback/src/ScopedCallback.php:57
Stack trace: 
#0 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(461): Wikimedia\ScopedCallback::consume() 
#1 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService('BootstrapConfig') 
#2 /var/www/html/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService('BootstrapConfig') 
#3 /var/www/html/includes/MediaWikiServices.php(851): MediaWiki\MediaWikiServices->getService('BootstrapConfig') 
#4 /var/www/html/includes/ServiceWiring.php(567): MediaWiki\MediaWikiServices->getBootstrapConfig() 
#5 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}(Object(MediaWiki\MediaWikiServices)) 
#6 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService('ConfigFactory') 
#7 /var/www/html/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService('ConfigFactory') 
#8 /var/www/html/includes/MediaWikiServices.php(928): MediaWiki\MediaWikiServices->getService('ConfigFactory') 
#9 /var/www/html/includes/ServiceWiring.php(1214): MediaWiki\MediaWikiServices->getConfigFactory() 
#10 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}(Object(MediaWiki\MediaWikiServices)) 
#11 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService('MainConfig') 
#12 /var/www/html/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService('MainConfig') 
#13 /var/www/html/includes/MediaWikiServices.php(1387): MediaWiki\MediaWikiServices->getService('MainConfig') 
#14 /var/www/html/includes/ServiceWiring.php(712): MediaWiki\MediaWikiServices->getMainConfig() 
#15 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}(Object(MediaWiki\MediaWikiServices)) 
#16 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService('DBLoadBalancerF...') 
#17 /var/www/html/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService('DBLoadBalancerF...') 
#18 /var/www/html/includes/MediaWikiServices.php(1066): MediaWiki\MediaWikiServices->getService('DBLoadBalancerF...') 
#19 /var/www/html/includes/exception/MWExceptionHandler.php(167): MediaWiki\MediaWikiServices->getDBLoadBalancerFactory() 
#20 /var/www/html/includes/exception/MWExceptionHandler.php(193): MWExceptionHandler::rollbackPrimaryChanges() 
#21 /var/www/html/includes/exception/MWExceptionHandler.php(236): MWExceptionHandler::rollbackPrimaryChangesAndLog(Object(ArgumentCountError), 'mwe_handler') 
#22 /var/www/html/includes/exception/MWExceptionHandler.php(205): MWExceptionHandler::handleException(Object(ArgumentCountError), 'mwe_handler') 
#23 [internal function]: MWExceptionHandler::handleUncaughtException(Object(ArgumentCountError)) 
#24 {main} thrown in /var/www/html/extensions/TemplateStyles/vendor/wikimedia/scoped-callback/src/ScopedCallback.php on line 57

Fatal error: Uncaught ArgumentCountError: Too few arguments to function Wikimedia\ScopedCallback::consume(), 0 passed in /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php on line 461 and exactly 1 expected in /var/www/html/extensions/TemplateStyles/vendor/wikimedia/scoped-callback/src/ScopedCallback.php:57
Stack trace: 
#0 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(461): Wikimedia\ScopedCallback::consume() 
#1 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService('BootstrapConfig') 
#2 /var/www/html/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService('BootstrapConfig') 
#3 /var/www/html/includes/MediaWikiServices.php(851): MediaWiki\MediaWikiServices->getService('BootstrapConfig') 
#4 /var/www/html/includes/ServiceWiring.php(923): MediaWiki\MediaWikiServices->getBootstrapConfig() 
#5 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(447): Wikimedia\Services\ServiceContainer::{closure}(Object(MediaWiki\MediaWikiServices)) 
#6 /var/www/html/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService('HookContainer') 
#7 /var/www/html/includes/MediaWikiServices.php(356): Wikimedia\Services\ServiceContainer->getService('HookContainer') 
#8 /var/www/html/includes/MediaWikiServices.php(1194): MediaWiki\MediaWikiServices->getService('HookContainer') 
#9 /var/www/html/includes/exception/MWExceptionHandler.php(793): MediaWiki\MediaWikiServices->getHookContainer() 
#10 /var/www/html/includes/exception/MWExceptionHandler.php(325): MWExceptionHandler::logError(Object(ErrorException), 'debug', 'mwe_handler') 
#11 [internal function]: MWExceptionHandler::handleError(2, 'file_put_conten...', '/var/www/html/i...', 521) 
#12 /var/www/html/includes/debug/logger/LegacyLogger.php(521): file_put_contents('/var/log/mediaw...', '[exception] [93...', 8) 
#13 /var/www/html/includes/debug/logger/LegacyLogger.php(197): MediaWiki\Logger\LegacyLogger::emit('[exception] [93...', '/var/log/mediaw...') 
#14 /var/www/html/vendor/psr/log/Psr/Log/AbstractLogger.php(69): MediaWiki\Logger\LegacyLogger->log(400, '[{reqId}] {exce...', Array) 
#15 /var/www/html/includes/exception/MWExceptionHandler.php(393): Psr\Log\AbstractLogger->error('[{reqId}] {exce...', Array) 
#16 [internal function]: MWExceptionHandler::handleFatalError() 
#17 {main} thrown in /var/www/html/extensions/TemplateStyles/vendor/wikimedia/scoped-callback/src/ScopedCallback.php on line 57

Seems to be that scoped callback v5 fatals if calling ScopedCallback::consume() with nothing ( I82366304eb16c9052914cd2c7ddb9f065c0057b1 / T376276 ). REL1_42 of MW appearently does this. TemplateStyles extension pulls in v5 of Scoped Callback, causing everything to fail.

Seems like TemplateStyles is ok with v3 - v5 of ScopedCallback, and composer doesn't know about MW requirements show pulls in the latest.

Event Timeline

Change #1088401 had a related patch set uploaded (by Brian Wolff; author: Brian Wolff):

[mediawiki/extensions/TemplateStyles@REL1_42] Pin wikimedia/scoped-callback to 1.42 in the REL1_42 branch

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

Change #1088402 had a related patch set uploaded (by Brian Wolff; author: Brian Wolff):

[mediawiki/extensions/TemplateStyles@REL1_41] Pin wikimedia/scoped-callback to 1.42 in the REL1_42 branch

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

Seems like TemplateStyles is ok with v3 - v5 of ScopedCallback, and composer doesn't know about MW requirements show pulls in the latest.

One of the ever problems of running composer directly in extension folders vs in the root of mw core with the composer merge plugin

Using wikimedia/services in version 3.0.0 together with wikimedia/scoped-callback version 5.0.0 does not work as the bump in 26dbce1abbaf4ebf856a1c6d2a79d9ea130ad31d is not released yet (tracked via T379384)

TemplateStyles requires wikimedia/css-sanitizer version ^5.1.0 || ^5.2.0, your composer seems to use 5.4.0 released with 7d0a15de3d234fd083aa6b0cb3fb6ac817089ece including the wikimedia/scopedcallback bump. But older scopedcallback are also allowed. composer should install the compatible version for scoped callback.

Possible fixes:

  • Release css-sanitizer 5.4.1 with scopedcallback 4.0.0 to remove 5.0.0 and release css-sanitizer 6.0.0 afterwards as it contains breaking change
  • Use ~5.1.0 || ~5.2.0 in TemplateStyles to avoid update to 5.4.0 (this does not help existing installs when running composer update)
  • Release scoped callback 5.0.1 without breaking change?

Running composer update right now on master also brings in this breaking change when not using the merge plugin, needs bump of services in core to fix.

Using wikimedia/services in version 3.0.0 together with wikimedia/scoped-callback version 5.0.0 does not work as the bump in 26dbce1abbaf4ebf856a1c6d2a79d9ea130ad31d is not released yet (tracked via T379384)

TemplateStyles requires wikimedia/css-sanitizer version ^5.1.0 || ^5.2.0, your composer seems to use 5.4.0 released with 7d0a15de3d234fd083aa6b0cb3fb6ac817089ece including the wikimedia/scopedcallback bump. But older scopedcallback are also allowed. composer should install the compatible version for scoped callback.

Possible fixes:

  • Release css-sanitizer 5.4.1 with scopedcallback 4.0.0 to remove 5.0.0 and release css-sanitizer 6.0.0 afterwards as it contains breaking change
  • Use ~5.1.0 || ~5.2.0 in TemplateStyles to avoid update to 5.4.0 (this does not help existing installs when running composer update)
  • Release scoped callback 5.0.1 without breaking change?

Running composer update right now on master also brings in this breaking change when not using the merge plugin, needs bump of services in core to fix.

I think we should change ^ to ~ per your suggestion to prevent the problem in the future.

Change #1088709 had a related patch set uploaded (by Paladox; author: Paladox):

[mediawiki/extensions/TemplateStyles@master] Fix composer pinning of packages

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

Change #1088402 merged by jenkins-bot:

[mediawiki/extensions/TemplateStyles@REL1_41] Pin wikimedia/scoped-callback to 4.0.0 in the REL1_41 branch

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

Change #1088401 merged by jenkins-bot:

[mediawiki/extensions/TemplateStyles@REL1_42] Pin wikimedia/scoped-callback to 4.0.0 in the REL1_42 branch

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

Tgr assigned this task to Bawolff.

Change #1088709 abandoned by Paladox:

[mediawiki/extensions/TemplateStyles@master] Fix composer pinning of packages

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