Fix type mismatch between what is returned by getLinkList (list of arrays that contains non-serializable TitleValue) and what is expected by ParserOutput.#325
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| // we can remove the templates by save/restore | ||
| if ( $reset['templates'] ?? false ) { | ||
| $saveTemplates = $parserOutput->getLinkList( ParserOutputLinkTypes::TEMPLATE ); | ||
| $saveTemplates = $parserOutput->mTemplates; |
There was a problem hiding this comment.
This will only mean they can't be accessed at all in newer MediaWiki because these are private in ParserOutput now: https://github.com/wikimedia/mediawiki/blob/46ac6adf8581ebdfd1a5225aaafe5684b140c25d/includes/parser/ParserOutput.php#L174
There was a problem hiding this comment.
Yes, these fields are private, but the __get() and __set() methods are still available in ParserOutput.
They are currently used here: DynamicPageList3 Hooks.php, line 606.
This should fix the issue for now. However, there will be problems when these deprecated methods are removed, but I don't see any alternatives.
…arrays that contains non-serializable TitleValue) and what is expected by ParserOutput.
52af4aa to
882e76c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #325 +/- ##
============================================
+ Coverage 10.77% 12.87% +2.09%
- Complexity 1569 1576 +7
============================================
Files 23 23
Lines 4259 4776 +517
============================================
+ Hits 459 615 +156
- Misses 3800 4161 +361 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The new version of DPL is causing MediaWiki to log
Unable to serialize JSONexceptions on some of the pages whenParserCacheis trying to serializeParserOutputto JSON.This is caused by the fact that the new getLinkList is not a 1:1 replacement for various deprecated getters in
ParserOutput, as it returns a different type of data. And we shouldn't assign that to the internal fields ofParserOutput.For now, I have replaced it with direct field access, as I currently see no other viable solution to resolve this issue.