From: X! Date: Tue, 4 Jan 2011 01:51:48 +0000 (+0000) Subject: Forcing array breaks MWFunction with <2 parameters X-Git-Tag: 1.31.0-rc.0~32843 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=3e36a442e720f4110563dc3c9f53e391c35cfe2d;p=lhc%2Fweb%2Fwiklou.git Forcing array breaks MWFunction with <2 parameters --- diff --git a/includes/MWFunction.php b/includes/MWFunction.php index 8c646f6414..8a944df204 100644 --- a/includes/MWFunction.php +++ b/includes/MWFunction.php @@ -30,8 +30,6 @@ class MWFunction { } } - $callback = (array) $callback; - if( count( $callback ) == 2 && $callback[0] == 'self' || $callback[0] == 'parent' ) { throw new MWException( 'MWFunction cannot call self::method() or parent::method()' ); diff --git a/tests/phpunit/includes/GlobalTest.php b/tests/phpunit/includes/GlobalTest.php index 4f0e0ec023..26a5165e74 100644 --- a/tests/phpunit/includes/GlobalTest.php +++ b/tests/phpunit/includes/GlobalTest.php @@ -421,8 +421,8 @@ class GlobalTest extends MediaWikiTestCase { array_unshift( $param_set, $sampleUTF ); $this->assertEquals( - call_user_func_array( 'mb_substr', $param_set ), - call_user_func_array( array( 'Fallback', 'mb_substr' ), $param_set ), + MWFunction::callArray( 'mb_substr', $param_set ), + MWFunction::callArray( 'Fallback::mb_substr', $param_set ), 'Fallback mb_substr with params ' . implode( ', ', $old_param_set ) ); } @@ -451,14 +451,14 @@ class GlobalTest extends MediaWikiTestCase { array_unshift( $param_set, $sampleUTF ); $this->assertEquals( - call_user_func_array( 'mb_strpos', $param_set ), - call_user_func_array( array( 'Fallback', 'mb_strpos' ), $param_set ), + MWFunction::callArray( 'mb_strpos', $param_set ), + MWFunction::callArray( 'Fallback::mb_strpos', $param_set ), 'Fallback mb_strpos with params ' . implode( ', ', $old_param_set ) ); $this->assertEquals( - call_user_func_array( 'mb_strrpos', $param_set ), - call_user_func_array( array( 'Fallback', 'mb_strrpos' ), $param_set ), + MWFunction::callArray( 'mb_strrpos', $param_set ), + MWFunction::callArray( 'Fallback::mb_strrpos', $param_set ), 'Fallback mb_strrpos with params ' . implode( ', ', $old_param_set ) ); }