Last modified: 2014-08-24 18:57:26 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T71939, the corresponding Phabricator task for complete and up-to-date bug report information.
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)
1.24rc
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: ---


Attachments

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.

[0] https://gerrit.wikimedia.org/r/#/q/status:merged+project:mediawiki/core+branch:master+topic:phpcs,n,z
[1] https://gerrit.wikimedia.org/r/#/c/151370/
[2] http://php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members
[3] https://www.mediawiki.org/wiki/Deprecation
[4] https://www.mediawiki.org/wiki/Special:Code/MediaWiki/85288#c17504

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.


Navigation
Links