exception: Skip use of HookRunner when not autoloaded

When autoload of HookRunner class fails (due to wrong namespaced
interface), it cannot be used in the exception handler,
that results in error about not found class, hiding the real error.

Bug: T387408
Change-Id: I93daa8b05bab42a4008a3bc09f26c7e041030a22
(cherry picked from commit 2037f6e41fcfa4b5240912f7fe09bc28ea1f0ae9)
This commit is contained in:
Umherirrender 2025-06-28 11:22:39 +02:00 committed by Reedy
parent c3bdae9eca
commit 101639f81c

View file

@ -799,7 +799,10 @@ TXT;
// initialization, e.g. if an autoloaded file triggers deprecation warnings.
// To avoid a difficult-to-debug autoload loop, avoid attempting to initialize the service
// container here. (T380456).
if ( !MediaWikiServices::hasInstance() ) {
// The exception handler is also triggered when autoloading of HookRunner class fails,
// > Uncaught Error: Class "MediaWiki\HookContainer\HookRunner" not found
// Avoid use of the not-loaded class here, as that override the real error.
if ( !MediaWikiServices::hasInstance() || !class_exists( HookRunner::class, false ) ) {
return;
}