User "Tim Starling" posted a comment on MediaWiki.r85288.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/85288#c17504
Commit summary:

Implement magic accessors for RequestContext variables: you can now just call 
$context->request->stuff(), and that is internally mapped to the get accessor.  
Rename the private variables to the old $mName syntax: I know that that's 
"discouraged in new code", but in this case it stops over-clever IDEs 
highlighting the magic accesses as potential visibility errors and sticking big 
error tags on them.

Comment:

You can't use __get() in PHP. 

I tried it once before, but I had to self-revert because PHP's implementation 
of it is so broken. The issue is the re-entry guard, which will randomly break 
your code due to subtle changes in initialisation order. If you try to re-enter 
__get(), even with a different $name, PHP will stop the function from being 
called and will return null instead, without even raising a warning. So if one 
of the get*() functions happens to depend on another lazy-initialised member of 
RequestContext, the result is subtle breakage dependent on initialisation 
order. 

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to