Jump to content

Topic on Extension talk:PageAuthors/Flow

Call to undefined method MediaWiki\User\UserIdentityValue::isSystemUser()

5
Summary by Sophivorus

Fixed in version 1.2+

AdamMillerchip (talkcontribs)

When attempting to preview a page after adding {{PAGEAUTHORS}} on MW 1.37.2 the UI displays the following error: Fatal exception of type "Error". I'm currently trying to see if I can get a better error from the logs.

I'm not sure if this is a problem with this extension or MediaWiki.

AdamMillerchip (talkcontribs)

Here's a stacktrace:

[exception] [YnEax3VZBTnpsbdGF5gDiwAAACg] index.php?title=Test&action=submit   Error: Call to undefined method MediaWiki\User\UserIdentityValue::isSystemUser()
#0 /extensions/PageAuthors/PageAuthors.php(37): PageAuthors::getPageAuthors(Parser)
#1 /includes/HookContainer/HookContainer.php(338): PageAuthors::onParserGetVariableValueSwitch(Parser, array, string, NULL, PPFrame_Hash)
#2 /includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#3 /includes/HookContainer/HookRunner.php(2898): MediaWiki\HookContainer\HookContainer->run(string, array)
#4 /includes/parser/Parser.php(2830): MediaWiki\HookContainer\HookRunner->onParserGetVariableValueSwitch(Parser, array, string, NULL, PPFrame_Hash)
#5 /includes/parser/Parser.php(3053): Parser->expandMagicVariable(string, PPFrame_Hash)
#6 /includes/parser/PPFrame_Hash.php(273): Parser->braceSubstitution(array, PPFrame_Hash)
#7 /includes/parser/Parser.php(2930): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#8 /includes/parser/Parser.php(1598): Parser->replaceVariables(string)
#9 /includes/parser/Parser.php(656): Parser->internalParse(string)
#10 /includes/content/WikitextContent.php(327): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
#11 /includes/content/AbstractContent.php(548): WikitextContent->fillParserOutput(Title, NULL, ParserOptions, boolean, ParserOutput)
#12 /includes/EditPage.php(4214): AbstractContent->getParserOutput(Title, NULL, ParserOptions)
#13 /includes/EditPage.php(4117): EditPage->doPreviewParse(WikitextContent)
#14 /includes/EditPage.php(2895): EditPage->getPreviewText()
#15 /includes/EditPage.php(722): EditPage->showEditForm()
#16 /includes/actions/EditAction.php(71): EditPage->edit()
#17 /includes/actions/SubmitAction.php(38): EditAction->show()
#18 /includes/MediaWiki.php(543): SubmitAction->show()
#19 /includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#20 /includes/MediaWiki.php(930): MediaWiki->performRequest()
#21 /includes/MediaWiki.php(564): MediaWiki->main()
#22 /index.php(53): MediaWiki->run()
#23 /index.php(46): wfIndexMain()
#24 {main}
AdamMillerchip (talkcontribs)

Just reproduced this on Mediawiki 1.38.2

My knowledge of PHP is not really good enough to diagnose further. Have confirmed that there is indeed no isSystemUser method on the UserIdentityValue class. There is one on User though.

This post was hidden by AdamMillerchip (history)
AdamMillerchip (talkcontribs)

I got it working by adding a lookup of the User object. I'm not sure if that's a reasonable solution though.

$revisionUserIdentity = $revision->getUser();
$revisionUser = $userFactory->newFromId($revisionUserIdentity->getId());