From 5251182086b27401d4e7abda45b36b140110dcbb Mon Sep 17 00:00:00 2001 From: Madhurima Deb Date: Thu, 16 Jul 2026 13:56:19 +0200 Subject: [PATCH] Fix MW 1.47 compatibility: OutputPage::parserOptions() was removed OutputPage::parserOptions() was removed in MediaWiki core (wikimedia/mediawiki@3772013). FormatterBuilder still called it, causing FormattingTest::testHtmlFormat to fail on MW master and item pages with localMedia statements to fatal on MW 1.47. Use ParserOptions::newFromContext() instead, which is available in all supported MediaWiki versions. Fixes #50 --- src/Services/FormatterBuilder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/FormatterBuilder.php b/src/Services/FormatterBuilder.php index 3e7ba88..48688ff 100644 --- a/src/Services/FormatterBuilder.php +++ b/src/Services/FormatterBuilder.php @@ -4,6 +4,7 @@ namespace Wikibase\LocalMedia\Services; +use ParserOptions; use RequestContext; use ValueFormatters\FormatterOptions; use ValueFormatters\ValueFormatter; @@ -27,7 +28,7 @@ public function newFormatter( string $format, FormatterOptions $options ): Value if ( $snakFormat->isPossibleFormat( SnakFormatter::FORMAT_HTML_VERBOSE, $format ) ) { return new InlineImageFormatter( - RequestContext::getMain()->getOutput()->parserOptions(), + ParserOptions::newFromContext( RequestContext::getMain() ), $this->thumbLimits, $options->getOption( ValueFormatter::OPT_LANG ), new LocalImageLinker(),