Page MenuHomePhabricator

PHP Fatal error: Uncaught Error: Class "MediaWiki\HookContainer\HookRunner" not found
Open, Needs TriagePublic

Description

Not sure if this is similar to T307816: Installing MediaWiki: Error: Class "FormatJson" not found...

But trying to use update.php (or eval.php, or presumably any maintenance script?) on a long existing MW 1.39 install, but using opcache that will be warmed on master of MW..

reedy@ubuntu64-web-esxi:/var/www/wiki-1.39/core$ php -v
PHP 8.4.4 (cli) (built: Feb 15 2025 08:59:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.4, Copyright (c), by Zend Technologies
    with Xdebug v3.4.1, Copyright (c) 2002-2025, by Derick Rethans
reedy@ubuntu64-web-esxi:/var/www/wiki-1.39/core$ php maintenance/update.php
PHP Fatal error:  Uncaught Error: Class "MediaWiki\HookContainer\HookRunner" not found in /var/www/wiki-1.39/core/includes/Hooks.php:174
Stack trace:
#0 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(807): Hooks::runner()
#1 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(336): MWExceptionHandler::logError()
#2 /var/www/wiki-1.39/core/vendor/composer/ClassLoader.php(576): MWExceptionHandler::handleError()
#3 /var/www/wiki-1.39/core/vendor/composer/ClassLoader.php(576): include('...')
#4 /var/www/wiki-1.39/core/vendor/composer/ClassLoader.php(427): {closure:Composer\Autoload\ClassLoader::initializeIncludeClosure():575}()
#5 /var/www/wiki-1.39/core/vendor/wikimedia/services/src/ServiceContainer.php(441): Composer\Autoload\ClassLoader->loadClass()
#6 /var/www/wiki-1.39/core/vendor/wikimedia/services/src/ServiceContainer.php(411): Wikimedia\Services\ServiceContainer->createService()
#7 /var/www/wiki-1.39/core/includes/MediaWikiServices.php(301): Wikimedia\Services\ServiceContainer->getService()
#8 /var/www/wiki-1.39/core/includes/MediaWikiServices.php(951): MediaWiki\MediaWikiServices->getService()
#9 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(165): MediaWiki\MediaWikiServices->getDBLoadBalancerFactory()
#10 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(191): MWExceptionHandler::rollbackPrimaryChanges()
#11 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(247): MWExceptionHandler::rollbackPrimaryChangesAndLog()
#12 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(216): MWExceptionHandler::handleException()
#13 [internal function]: MWExceptionHandler::handleUncaughtException()
#14 {main}
  thrown in /var/www/wiki-1.39/core/includes/Hooks.php on line 174

Event Timeline

Not sure if this is similar to T307816: Installing MediaWiki: Error: Class "FormatJson" not found...

But trying to use update.php on a long existing MW 1.39 install, but using opcache that will be warmed on master of MW..

Maybe not, reboot the host and still failing...

This feels dejavu.

Running the wiki via apache on PHP 8.4 is apparently fine.

Maybe apply the fix from T379125 / 5cf3cd03dfd3f7acca4d78bf12054f3c315fee28 locally to see if that helps seeing the real error (maybe T379587 but only called by cli path).

Maybe apply the fix from T379125 / 5cf3cd03dfd3f7acca4d78bf12054f3c315fee28 locally to see if that helps seeing the real error (maybe T379587 but only called by cli path).

Thanks for the hint!

I've done the cherry pick (and amends) in Gerrit. Will test locally to see

It changes/simplifies the stack trace a bit, but unfortunately doesn't fundamentally change the error:

reedy@ubuntu64-web-esxi:/var/www/wiki-1.39/core$ php8.4 maintenance/update.php
PHP Fatal error:  Uncaught Error: Class "MediaWiki\HookContainer\HookRunner" not found in /var/www/wiki-1.39/core/includes/Hooks.php:174
Stack trace:
#0 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(820): Hooks::runner()
#1 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(764): MWExceptionHandler::callLogExceptionHook()
#2 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(195): MWExceptionHandler::logException()
#3 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(249): MWExceptionHandler::rollbackPrimaryChangesAndLog()
#4 /var/www/wiki-1.39/core/includes/exception/MWExceptionHandler.php(218): MWExceptionHandler::handleException()
#5 [internal function]: MWExceptionHandler::handleUncaughtException()
#6 {main}
  thrown in /var/www/wiki-1.39/core/includes/Hooks.php on line 174

I've just +2'd it on REL1_39 and REL1_42, as they're not going to cause any harm in that regard, but maybe help.

I've run into this as well, on PHP 8.4.7, using mediawiki 1.39.12, nginx 1.26.3.

$ php -v
PHP 8.4.7 (cli) (built: May  6 2025 12:31:58) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Fedora Project
Zend Engine v4.4.7, Copyright (c) Zend Technologies

$ php maintenance/update.php 
PHP Fatal error:  Uncaught Error: Class "MediaWiki\HookContainer\HookRunner" not found in /var/www/ctlwiki/includes/Hooks.php:174
Stack trace:
#0 /var/www/ctlwiki/includes/exception/MWExceptionHandler.php(820): Hooks::runner()
#1 /var/www/ctlwiki/includes/exception/MWExceptionHandler.php(764): MWExceptionHandler::callLogExceptionHook()
#2 /var/www/ctlwiki/includes/exception/MWExceptionHandler.php(195): MWExceptionHandler::logException()
#3 /var/www/ctlwiki/includes/exception/MWExceptionHandler.php(249): MWExceptionHandler::rollbackPrimaryChangesAndLog()
#4 /var/www/ctlwiki/includes/exception/MWExceptionHandler.php(218): MWExceptionHandler::handleException()
#5 [internal function]: MWExceptionHandler::handleUncaughtException()
#6 {main}
  thrown in /var/www/ctlwiki/includes/Hooks.php on line 174

Change #1155294 had a related patch set uploaded (by Nnyby; author: Nnyby):

[mediawiki/core@REL1_39] Conditionally load MWExceptionHandler's HookRunner

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

Change #1164550 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] exception: Skip use of HookRunner when not autoloaded.

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

Change #1164550 merged by jenkins-bot:

[mediawiki/core@master] exception: Skip use of HookRunner when not autoloaded

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

Change #1164625 had a related patch set uploaded (by Reedy; author: Umherirrender):

[mediawiki/core@REL1_44] exception: Skip use of HookRunner when not autoloaded

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

Change #1164626 had a related patch set uploaded (by Reedy; author: Umherirrender):

[mediawiki/core@REL1_43] exception: Skip use of HookRunner when not autoloaded

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

Change #1164625 merged by jenkins-bot:

[mediawiki/core@REL1_44] exception: Skip use of HookRunner when not autoloaded

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

Change #1164626 merged by jenkins-bot:

[mediawiki/core@REL1_43] exception: Skip use of HookRunner when not autoloaded

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

Change #1155294 abandoned by Nnyby:

[mediawiki/core@REL1_39] Conditionally load MWExceptionHandler's HookRunner

Reason:

Better patch is here: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1164626

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

Change #1167728 had a related patch set uploaded (by Nnyby; author: Nnyby):

[mediawiki/core@REL1_39] exception: Skip use of HookRunner when not autoloaded

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

Change #1172410 had a related patch set uploaded (by Reedy; author: Umherirrender):

[mediawiki/core@REL1_39] exception: Skip use of HookRunner when not autoloaded

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

Change #1167728 abandoned by Reedy:

[mediawiki/core@REL1_39] exception: Skip use of HookRunner when not autoloaded

Reason:

Properly cherry picked via https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1172409/2 and https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1172410/1

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

Change #1172410 merged by jenkins-bot:

[mediawiki/core@REL1_39] exception: Skip use of HookRunner when not autoloaded

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