https://bugzilla.wikimedia.org/show_bug.cgi?id=69939

            Bug ID: 69939
           Summary: Deprecate direct access to class variables
           Product: MediaWiki
           Version: 1.24-git
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: General/Unknown
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: s7ep...@gmail.com
       Web browser: ---
   Mobile Platform: ---

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)

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to