Fix WikibaseLocalMedia crash on MW 1.47 (OutputPage::parserOptions removed)#334
Merged
physikerwelt merged 1 commit intoJul 15, 2026
Conversation
MW 1.47 removed OutputPage::parserOptions(), which WikibaseLocalMedia still calls in FormatterBuilder, so every item page with a localMedia statement fails with an internal error (e.g. Item:Q4610 on staging). Upstream fix exists but is not merged yet: ProfessionalWiki/WikibaseLocalMedia#46 Apply the equivalent one-line patch (ParserOptions::newFromContext) at image build time, following the existing patch convention. Remove once upstream merges PR 46 and a release is cut. Refs MaRDI4NFDI/MaRDIRoadmap#208
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughChangesWikibase parser options workaround
Estimated code review effort: 1 (Trivial) | ~5 minutes Sequence Diagram(s)sequenceDiagram
participant Dockerfile
participant clone_all.sh
participant WikibaseLocalMedia
Dockerfile->>clone_all.sh: Copy parser-options patch
clone_all.sh->>WikibaseLocalMedia: Apply patch
WikibaseLocalMedia->>WikibaseLocalMedia: Construct ParserOptions from RequestContext
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author
|
@physikerwelt eady for review - CI green, image built. Happy to also prepare the portal-k8s staging tag bump once this is merged |
physikerwelt
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Item pages with a
localMediastatement fail with an internal error on staging, e.g.https://staging.mardi4nfdi.org/wiki/Item:Q4610:
OutputPage::parserOptions()was deprecated in MW 1.44 and no longer exists inwmf/1.47.0-wmf.9(the branch this image builds, seeclone_all.sh).Note this is a second, separate incompatibility from the one reported in
MaRDI4NFDI/MaRDIRoadmap#208: that crash (
ArgumentCountErrorinFile::getDimensionsString()) was fixed upstream in WikibaseLocalMedia 2.0.1,which the image already gets by cloning
master. ThisparserOptionscrashoccurs earlier in the same code path and blocks the same pages.
Fix
Upstream fix exists but is not merged yet:
ProfessionalWiki/WikibaseLocalMedia#46
This PR applies the equivalent one-line change at image build time, following
the repo's existing patch convention (
patch -Np1inclone_all.sh):FormatterBuilder.php:RequestContext::getMain()->getOutput()->parserOptions()→
ParserOptions::newFromContext( RequestContext::getMain() )ParserOptions::newFromContext()is the documented replacement and exists inboth older and current MediaWiki, so the patch is version-safe. The patch is
verified to apply cleanly against current WikibaseLocalMedia
master.Also adds
.gitattributeswith*.patch -textso patch files are neversubject to line-ending conversion.
This is a temporary workaround — remove the patch once upstream merges
PR 46 and cuts a release.
After merge
portal-k8sapps/staging/wikibase/values-staging.yaml(currently
sha-9991dbc) to the new build.image dimensions caption (that caption also exercises the 2.0.1 fix for the
original Bump actions/checkout from 4.2.2 to 5.0.0 #208 error).
Refs MaRDI4NFDI/MaRDIRoadmap#208
Summary by CodeRabbit