Last modified: 2014-08-24 18:57:26 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 69939 - Deprecate direct access to class variables
Deprecate direct access to class variables
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: code_quality
  Show dependency treegraph
Reported: 2014-08-23 15:20 UTC by s7eph4n
Modified: 2014-08-24 18:57 UTC (History)
0 users

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


Description s7eph4n 2014-08-23 15:20:51 UTC
In MW 1.24 an effort was made to improve code quality by making it phpcs-strict compliant [0]. This involves explicitly declaring the visibility of class members. In the course of this, in many cases the class variable's visibility was changed from the implicit 'public' to explicit 'protected' or 'private', thus introducing a major API change without proper deprecation period.

To keep the changes and still be able to properly deprecate the direct access to the member variables a patch [1] was submitted that makes use of PHP magic functions [2]. The introduced functions provide access to the formerly public class members and issue a deprecation warning. For old PHP versions a warning by Tim Starling existed [4], to avoid __get(). However, this does not apply to the current case, as the __get method is not used re-entrantly. Moreover, it is questionable, whether this warning is still valid for recent versions of PHP.


The intention is to keep these functions for the custom two releases [3], i.e. until 1.26, and then remove them.

Affected classes, files and action required for removal:
* CategoryViewer (CategoryViewer.php; delete magic functions)
* EditPage (EditPage.php; delete magic functions)
* WikiExporter (Export.php; delete magic functions)
* DumpLatestFilter (Export.php; delete magic functions)
* FeedItem (Feed.php; delete magic functions)
* DiffHistoryBlob (HistoryBlob.php; delete magic functions)
* WikiRevision (Import.php; delete magic functions)
* Article (Article.php; delete magic functions __isset() and __unset(), modify __get() and __set() to not return private variables of Article anymore)

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