Page MenuHomePhabricator

Parser getVariableValue() $index parameter comment inaccurate
Closed, ResolvedPublic

Description

I had trouble finding the implementation of CURRENTMONTH in includes/parser.

It turns out it's implemented by Parser::getVariableValue in lowercase

switch ( $index ) {
         case 'currentmonth':
              ... do something

even though {{currentmonth}} in wikitext doesn't work. The only doc for the $index parameter to this function is @param int $index , but it's definitely not an integer.

A quick fix is to change the doxygen comment to something like

@param string $index   Magic variable identifier. Note that it's lowercase by the time this function is called.

I think MagicWord.php converts from capitalized magic variables to lowercase internals, I'm not sure where this should be documented.

Event Timeline

Spage raised the priority of this task from to Low.
Spage updated the task description. (Show Details)
Spage added a subscriber: Spage.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 20 2015, 11:45 PM

Change 338532 had a related patch set uploaded (by EddieGP):
Fixed documentation on Parser::getVariableValue

https://gerrit.wikimedia.org/r/338532

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptFeb 18 2017, 1:16 PM
EddieGP claimed this task.Feb 18 2017, 1:19 PM

Change 338532 merged by jenkins-bot:
Fixed documentation on Parser::getVariableValue

https://gerrit.wikimedia.org/r/338532