Forcing array breaks MWFunction with <2 parameters
authorX! <soxred93@users.mediawiki.org>
Tue, 4 Jan 2011 01:51:48 +0000 (01:51 +0000)
committerX! <soxred93@users.mediawiki.org>
Tue, 4 Jan 2011 01:51:48 +0000 (01:51 +0000)
includes/MWFunction.php
tests/phpunit/includes/GlobalTest.php

index 8c646f6..8a944df 100644 (file)
@@ -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()' );
index 4f0e0ec..26a5165 100644 (file)
@@ -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 )
                        );      
                }