"Alphos" posted a comment on MediaWiki.r106603.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/106603#c28761

Commit summary for MediaWiki.r106603:

restore compat w/ mw 1.18

Alphos's comment:

Just saying guys : <code>method_exists( $this, 'getLanguage' )</code> will 
always return true, since the name of that method '''is''' "getLanguage".

Thus that function will always return the middle operand of the ternary 
(<code>$this->getLanguage()</code>).

However, <code>$this->getLanguage()</code> '''is''' the method itself. Which 
means that method will always call itself. And that internal call to itself 
will again check if that method exists, and since it does (because it's 
declared right there) it will, in turn, call itself. From now on, read that 
comment from the top, ad libitum.

Recursive functions are fine to play with, recursive (non-static) methods 
trigger some rather black magic one should avoid as much as possible…

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

Reply via email to