From 3e36a442e720f4110563dc3c9f53e391c35cfe2d Mon Sep 17 00:00:00 2001 From: X! Date: Tue, 4 Jan 2011 01:51:48 +0000 Subject: [PATCH] Forcing array breaks MWFunction with <2 parameters --- includes/MWFunction.php | 2 -- tests/phpunit/includes/GlobalTest.php | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) 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 ) ); } -- 2.20.1