Hey,
I just got a bug report for the following code:
$realFunction = array( 'OutputPage', 'includeJQuery' ); if ( is_callable( $realFunction ) ) { //... }
The user is getting a strict warning because the includeJQuery is not static. Now I'm wondering why this check is done in such an odd way to begin with, this would be a lot simpler:
if ( method_exists( $wgOut, 'includeJQuery' ) ) { ... }
I vaguely remember someone saying something about this beeing needed for HipHop, but can't find this documented anywhere where such checks are used. So can someone enlighten me here? :)
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --
On 16/08/11 16:46, Jeroen De Dauw wrote:
Hey,
I just got a bug report for the following code:
$realFunction = array( 'OutputPage', 'includeJQuery' ); if ( is_callable( $realFunction ) ) { //... }
I can not find that code in 1.17 or trunk. But a similar code exist in trunk in Skin.php at ContextSource::__call() (end of file).
The code was introduced by Tim Starling in r85310 [1] with commit message: HipHop does not support the static form of method_exists().
The user is getting a strict warning because the includeJQuery is not static. Now I'm wondering why this check is done in such an odd way to begin with, this would be a lot simpler:
if ( method_exists( $wgOut, 'includeJQuery' ) ) { ... }
I vaguely remember someone saying something about this beeing needed for HipHop, but can't find this documented anywhere where such checks are used. So can someone enlighten me here? :)
[1] http://www.mediawiki.org/wiki/Special:Code/MediaWiki/85310
Hey,
I can not find that code in 1.17 or trunk. But a similar code exist in
trunk in Skin.php at ContextSource::__call() (end of file).
Indeed. It is in a whole bunch of extensions though, which is not very surprising, since extensions need to do compat checks, while core does not have to worry about that.
The code was introduced by Tim Starling in r85310 [1] with commit
message: HipHop does not support the static form of method_exists().
So is there HipHop compatible code that does not annoy users w/ warnings?
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --
On Tue, Aug 16, 2011 at 11:06 AM, Jeroen De Dauw jeroendedauw@gmail.comwrote:
trunk in Skin.php at ContextSource::__call() (end of file).
I can not find that code in 1.17 or trunk. But a similar code exist in
Indeed. It is in a whole bunch of extensions though, which is not very surprising, since extensions need to do compat checks, while core does not have to worry about that.
The code was introduced by Tim Starling in r85310 [1] with commit
message: HipHop does not support the static form of method_exists().
So is there HipHop compatible code that does not annoy users w/ warnings?
What you want to do here is probably:
$func = array( $anActualInstanceOfOutputPage, 'theNonStaticMethodName' ); is_callable($func)
-- brion
wikitech-l@lists.wikimedia.org