oetterer / BootstrapComponents

Bootstrap Components is a MediaWiki extension that aims to provide editors with an easy access to certain components introduced by Twitter Bootstrap 4.
Other
6 stars 9 forks source link

Premature access to service container. #31

Closed VetSoftKeith closed 1 year ago

VetSoftKeith commented 2 years ago

Setup and configuration

Issue

Logs are spammed with page specific version of the below error message. Relevant Phabricator discussion here.

NOTE: The deprecation messages below were originally a single line. I added line breaks to improve readability.

Was previously fixed for MW 1.35 in #23.

PHP message: PHP Deprecated:  Premature access to service container [Called from BootstrapComponents\HookRegistry::registerMyConfiguration in /var/www/mediawiki/extensions/BootstrapComponents/src/HookRegistry.php at line 381] in /var/www/mediawiki/includes/debug/MWDebug.php on line 375

PHP message: PHP Deprecated:  Premature access to service 'HookContainer' [Called from MediaWiki\MediaWikiServices::getInstance in /var/www/mediawiki/includes/MediaWikiServices.php at line 267] in /var/www/mediawiki/includes/debug/MWDebug.php on line 375

PHP message: PHP Deprecated:  Premature access to service 'ObjectFactory' [Called from Wikimedia\Services\ServiceContainer::{closure} in /var/www/mediawiki/includes/ServiceWiring.php at line 618] in /var/www/mediawiki/includes/debug/MWDebug.php on line 375

PHP message: PHP Deprecated:  Premature access to service 'ConfigFactory' [Called from BootstrapComponents\HookRegistry::registerMyConfiguration in /var/www/mediawiki/extensions/BootstrapComponents/src/HookRegistry.php at line 381] in /var/www/mediawiki/includes/debug/MWDebug.php on line 375

PHP message: PHP Deprecated:  Premature access to service 'BootstrapConfig' [Called from Wikimedia\Services\ServiceContainer::{closure} in /var/www/mediawiki/includes/ServiceWiring.php at line 346] in /var/www/mediawiki/includes/debug/MWDebug.php on line 375" while reading response header from upstream, client: ***.***.***.18, server: ********.com, request: "GET /w/Talk:Brother_Bancroft HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "***********.com"

Steps to reproduce the observation (recommendation is to use the sandbox):

oetterer commented 2 years ago

@VetSoftKeith Thanks for bringing this to my attention. I looked into it and cannot promise a quick fix. Will know more in a few days.

D3nnis3n commented 2 years ago

Seeing the same issue with MW 1.81.1 and PHP 8.1.2 and wondered if there is any solution for this. On my little wiki it accounts for a 12 GB php-fpm log every few days.

kghbln commented 2 years ago

Also refs: https://phabricator.wikimedia.org/T273261

Seb35 commented 2 years ago

Seeing the same issue with MW 1.81.1 and PHP 8.1.2 and wondered if there is any solution for this. On my little wiki it accounts for a 12 GB php-fpm log every few days.

On a short term, to avoid filling logs with repetitive not-really-usefull messages, you can comment in includes/MediaWikiServices.php the two calls to wfDeprecatedMsg( 'Premature access to service container', … );.

D3nnis3n commented 2 years ago

Hello Seb35, thank you - I have achieved the same by using the following in my LocalSettings.php, which doesn't require changes on Updates:

$wgDeprecationReleaseLimit = '1.34';