Last modified: 2011-03-13 18:06:41 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 27562 - Make $wgVersion a constant
Make $wgVersion a constant
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: code_quality global-vars
  Show dependency treegraph
Reported: 2011-02-19 15:38 UTC by The Evil IP address
Modified: 2011-03-13 18:06 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description The Evil IP address 2011-02-19 15:38:34 UTC
Currently, $wgVersion is global variable from DefaultSettings.php, which means that it's easily possible for people to modify the variable in LocalSettings.php. I don't know if anyone ever did it, but if someone did it, this could break quite a lot of things. Version checks with version_compare() might be inaccurate, leading to certain functions/classes not to load or the information on Special:Version or {{VERSION}} give wrong information about the used software. Also, I could imagine people believing they could "update" MediaWiki by modifying $wgVersion.

Since there doesn't appear to be a need to modify $wgVersion, neither by the MediaWiki core, extensions or the site users, it could probably just as easily become a constant, maybe MW_VERSION, and then be used like that. This also has the nice side effect of getting rid of another global, which appear to be unloved within MediaWiki developers (IMO for good reasons).
Comment 1 Max Semenik 2011-02-19 15:41:53 UTC
This is PHP, everything can be screwed up by playing loose with globals. I don't see why $wgVersion is special.
Comment 2 Chad H. 2011-02-19 18:08:56 UTC
Replacing a global scoped variable with a global scoped define doesn't really change anything other than making it impossible for users to change.

And there is some valid reasons to change it: $wgVersion = '1.17wmf1'; ...etc etc.

In general, I think changing it would break more stuff than it would fix, so I'm gonna go ahead and WONTFIX this.

Note You need to log in before you can comment on or make changes to this bug.