diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2025-01-29 10:46:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2025-01-29 10:46:15 +0000 |
commit | 89759e92f4e3f3c3d572285d956bc212173929ba (patch) | |
tree | f49191effe53f5c05878a1eec39480bc689f5c1b | |
parent | 4190271110bc33ab31fc44e298c7786192c4e26c (diff) | |
parent | 0b1480e60ef7d649bf7d22de5a7c032d04ed0f7a (diff) | |
download | mediawikicore-89759e92f4e3f3c3d572285d956bc212173929ba.tar.gz mediawikicore-89759e92f4e3f3c3d572285d956bc212173929ba.zip |
Merge "exception: Avoid service container init in exception handler"
-rw-r--r-- | includes/exception/MWExceptionHandler.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index 25e638be66b4..a429efb2a839 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -794,6 +794,14 @@ TXT; */ private static function callLogExceptionHook( Throwable $e, bool $suppressed ) { try { + // It's possible for the exception handler to be triggered during service container + // 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() ) { + return; + } + ( new HookRunner( MediaWikiServices::getInstance()->getHookContainer() ) ) ->onLogException( $e, $suppressed ); } catch ( RecursiveServiceDependencyException $e ) { |