Update wfMessage doc
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index ddea620..490df24 100644 (file)
@@ -1407,7 +1407,7 @@ function wfGetLangObj( $langcode = false ) {
  *
  * This function replaces all old wfMsg* functions.
  *
- * @param string $key Message key
+ * @param string|string[] $key Message key, or array of keys
  * @param mixed $params,... Normal message parameters
  * @return Message
  *
@@ -3179,10 +3179,10 @@ function wfDiff( $before, $after, $params = '-u' ) {
 
        // Kill the --- and +++ lines. They're not useful.
        $diff_lines = explode( "\n", $diff );
-       if ( strpos( $diff_lines[0], '---' ) === 0 ) {
+       if ( isset( $diff_lines[0] ) && strpos( $diff_lines[0], '---' ) === 0 ) {
                unset( $diff_lines[0] );
        }
-       if ( strpos( $diff_lines[1], '+++' ) === 0 ) {
+       if ( isset( $diff_lines[1] ) && strpos( $diff_lines[1], '+++' ) === 0 ) {
                unset( $diff_lines[1] );
        }
 
@@ -3366,7 +3366,10 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1,
        );
 
        if ( extension_loaded( 'gmp' ) && ( $engine == 'auto' || $engine == 'gmp' ) ) {
-               $result = gmp_strval( gmp_init( $input, $sourceBase ), $destBase );
+               // Removing leading zeros works around broken base detection code in
+               // some PHP versions (see <https://bugs.php.net/bug.php?id=50175> and
+               // <https://bugs.php.net/bug.php?id=55398>).
+               $result = gmp_strval( gmp_init( ltrim( $input, '0' ), $sourceBase ), $destBase );
        } elseif ( extension_loaded( 'bcmath' ) && ( $engine == 'auto' || $engine == 'bcmath' ) ) {
                $decimal = '0';
                foreach ( str_split( strtolower( $input ) ) as $char ) {