* (bug 31289) Fix fatal error on special pages using $this->msg() on PHP 5.2
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 1 Oct 2011 02:03:05 +0000 (02:03 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 1 Oct 2011 02:03:05 +0000 (02:03 +0000)
According to online PHP docs, func_get_args() doesn't work in function parameter lists until PHP 5.3.0.
It does, however, work as the *first* parameter, which happens here and there in older code (eg array_slice(func_get_args(),1)).
Assigning to a variable and passing through works fine for this case on PHP 5.2.17.

includes/SpecialPage.php

index 872a493..77fecd9 100644 (file)
@@ -681,7 +681,12 @@ class SpecialPage {
         * @see wfMessage
         */
        public function msg( /* $args */ ) {
-               return call_user_func_array( array( $this->getContext(), 'msg' ), func_get_args() );
+               // Note: can't use func_get_args() directly as second or later item in
+               // a parameter list until PHP 5.3 or you get a fatal error.
+               // Works fine as the first parameter, which appears elsewhere in the
+               // code base. Sighhhh.
+               $args = func_get_args();
+               return call_user_func_array( array( $this->getContext(), 'msg' ), $args );
        }
 
        /**