Page MenuHomePhabricator

Invalid magic word "var" with master branch
Closed, InvalidPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):
The extension page for "Variables" notes to use the "master" branch to avoid missing functionality / deprecated warnings.
Doing that via the "Download Extension" button causes the error below. The error does not appear when getting the branch from Github.
This might be working as expected, but it would be useful to note in the error message that master needs to be downloaded directly on Github.

What happens?:
Error on wiki page.

MediaWiki internal error.

Original exception: [ZgLJyeQPfIKmnh1O_v222gAAAAo] /en/ MWException: Error: invalid magic word 'var'
Backtrace:
from /var/www/vhosts/domain.com/httpdocs/includes/parser/MagicWord.php(111)
#0 /var/www/vhosts/domain.com/httpdocs/includes/parser/MagicWordFactory.php(190): MediaWiki\Parser\MagicWord->load()
#1 /var/www/vhosts/domain.com/httpdocs/includes/parser/Parser.php(4915): MediaWiki\Parser\MagicWordFactory->get()
#2 /var/www/vhosts/domain.com/httpdocs/extensions/Variables/includes/VariablesHooks.php(43): Parser->setFunctionHook()
#3 /var/www/vhosts/domain.com/httpdocs/extensions/Variables/includes/VariablesHooks.php(24): VariablesHooks::initFunction()
#4 /var/www/vhosts/domain.com/httpdocs/includes/HookContainer/HookContainer.php(161): VariablesHooks::onParserFirstCallInit()
#5 /var/www/vhosts/domain.com/httpdocs/includes/HookContainer/HookRunner.php(2952): MediaWiki\HookContainer\HookContainer->run()
#6 /var/www/vhosts/domain.com/httpdocs/includes/parser/Parser.php(486): MediaWiki\HookContainer\HookRunner->onParserFirstCallInit()
#7 /var/www/vhosts/domain.com/httpdocs/includes/parser/ParserFactory.php(199): Parser->__construct()
#8 /var/www/vhosts/domain.com/httpdocs/includes/language/MessageCache.php(1454): ParserFactory->create()
#9 /var/www/vhosts/domain.com/httpdocs/includes/language/MessageCache.php(1435): MessageCache->getParser()
#10 /var/www/vhosts/domain.com/httpdocs/includes/language/Message.php(1464): MessageCache->transform()
#11 /var/www/vhosts/domain.com/httpdocs/includes/language/Message.php(1011): Message->transformText()
#12 /var/www/vhosts/domain.com/httpdocs/includes/language/Message.php(1059): Message->format()
#13 /var/www/vhosts/domain.com/httpdocs/includes/Output/OutputPage.php(1102): Message->text()
#14 /var/www/vhosts/domain.com/httpdocs/includes/Output/OutputPage.php(1178): MediaWiki\Output\OutputPage->setHTMLTitle()
#15 /var/www/vhosts/domain.com/httpdocs/includes/Output/OutputPage.php(1147): MediaWiki\Output\OutputPage->setPageTitleInternal()
#16 /var/www/vhosts/domain.com/httpdocs/includes/page/Article.php(496): MediaWiki\Output\OutputPage->setPageTitle()
#17 /var/www/vhosts/domain.com/httpdocs/includes/actions/ViewAction.php(78): Article->view()
#18 /var/www/vhosts/domain.com/httpdocs/includes/MediaWiki.php(583): ViewAction->show()
#19 /var/www/vhosts/domain.com/httpdocs/includes/MediaWiki.php(363): MediaWiki->performAction()
#20 /var/www/vhosts/domain.com/httpdocs/includes/MediaWiki.php(960): MediaWiki->performRequest()
#21 /var/www/vhosts/domain.com/httpdocs/includes/MediaWiki.php(613): MediaWiki->main()
#22 /var/www/vhosts/domain.com/httpdocs/index.php(50): MediaWiki->run()
#23 /var/www/vhosts/domain.com/httpdocs/index.php(46): wfIndexMain()
#24 {main}

Exception caught inside exception handler: [ZgLJyeQPfIKmnh1O_v222gAAAAo] /en/ MWException: Error: invalid magic word 'var'
Backtrace:
from /var/www/vhosts/domain.com/httpdocs/includes/parser/MagicWord.php(111)
#0 /var/www/vhosts/domain.com/httpdocs/includes/parser/MagicWordFactory.php(190): MediaWiki\Parser\MagicWord->load()
#1 /var/www/vhosts/domain.com/httpdocs/includes/parser/Parser.php(4915): MediaWiki\Parser\MagicWordFactory->get()
#2 /var/www/vhosts/domain.com/httpdocs/extensions/Variables/includes/VariablesHooks.php(43): Parser->setFunctionHook()
#3 /var/www/vhosts/domain.com/httpdocs/extensions/Variables/includes/VariablesHooks.php(24): VariablesHooks::initFunction()
#4 /var/www/vhosts/domain.com/httpdocs/includes/HookContainer/HookContainer.php(161): VariablesHooks::onParserFirstCallInit()
#5 /var/www/vhosts/domain.com/httpdocs/includes/HookContainer/HookRunner.php(2952): MediaWiki\HookContainer\HookContainer->run()
#6 /var/www/vhosts/domain.com/httpdocs/includes/parser/Parser.php(486): MediaWiki\HookContainer\HookRunner->onParserFirstCallInit()
#7 /var/www/vhosts/domain.com/httpdocs/includes/parser/ParserFactory.php(199): Parser->__construct()
#8 /var/www/vhosts/domain.com/httpdocs/includes/language/MessageCache.php(1454): ParserFactory->create()
#9 /var/www/vhosts/domain.com/httpdocs/includes/language/MessageCache.php(1435): MessageCache->getParser()
#10 /var/www/vhosts/domain.com/httpdocs/includes/language/Message.php(1464): MessageCache->transform()
#11 /var/www/vhosts/domain.com/httpdocs/includes/language/Message.php(1011): Message->transformText()
#12 /var/www/vhosts/domain.com/httpdocs/includes/language/Message.php(1059): Message->format()
#13 /var/www/vhosts/domain.com/httpdocs/includes/Output/OutputPage.php(1102): Message->text()
#14 /var/www/vhosts/domain.com/httpdocs/includes/Output/OutputPage.php(1178): MediaWiki\Output\OutputPage->setHTMLTitle()
#15 /var/www/vhosts/domain.com/httpdocs/includes/Output/OutputPage.php(1147): MediaWiki\Output\OutputPage->setPageTitleInternal()
#16 /var/www/vhosts/domain.com/httpdocs/includes/exception/MWException.php(176): MediaWiki\Output\OutputPage->setPageTitle()
#17 /var/www/vhosts/domain.com/httpdocs/includes/exception/MWException.php(220): MWException->reportHTML()
#18 /var/www/vhosts/domain.com/httpdocs/includes/exception/MWExceptionHandler.php(132): MWException->report()
#19 /var/www/vhosts/domain.com/httpdocs/includes/exception/MWExceptionHandler.php(251): MWExceptionHandler::report()
#20 /var/www/vhosts/domain.com/httpdocs/includes/MediaWiki.php(632): MWExceptionHandler::handleException()
#21 /var/www/vhosts/domain.com/httpdocs/index.php(50): MediaWiki->run()
#22 /var/www/vhosts/domain.com/httpdocs/index.php(46): wfIndexMain()
#23 {main}

What should have happened instead?:
No error when opening wiki.

Software version (skip for WMF-hosted wikis like Wikipedia):
Master of Variables (gotten 10 minutes ago) and MediaWiki 1.41

Event Timeline

D3nnis3n updated the task description. (Show Details)

I don't see any differences in the contents downloaded from GitHub and the extension distributor. Could you reproduce this reliably? I suspect the exception was either transient or due to the method you upload files to the server, e.g. some files failed to upload if you decompressed the tarball before uploading.

I used wget for both directly on the server after copying the link locally, but I didn't test it more than once.
It just seemed like the link provided via "Download extension" -> "master" gave a different version than when downloading from Github directly.

Totally possible it was just a fluke, but I wouldn't know why. It looked like there is a difference with one option breaking, so I wanted to give a hint in case someone else faces the same problem. (Searching phabricator helped me solve tons of problems today by just searching errors that Google wouldn't find, like Visual Editor edit problem still present in latest release)
Sorry, feel free to close :)

I just had time to try again and was not able to reproduce. Not sure what went wrong the first time - sorry, I'm closing myself.