X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FCoreParserFunctions.php;h=0e30b3c867ff791612dfa9415c795486c41a0a8d;hb=c97a593ebd397e5883a1700e658e0653db10577b;hp=c6a10aefbc0be868c2c529378c9b154e83b8b757;hpb=803f3867b7fcbb5fcee405f5c10cfa06cb857bd6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index c6a10aefbc..0e30b3c867 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -830,7 +830,7 @@ class CoreParserFunctions { $restrictions = $titleObject->getRestrictions( strtolower( $type ) ); # Title::getRestrictions returns an array, its possible it may have # multiple values in the future - return implode( $restrictions, ',' ); + return implode( ',', $restrictions ); } return ''; } @@ -882,7 +882,7 @@ class CoreParserFunctions { * Unicode-safe str_pad with the restriction that $length is forced to be <= 500 * @param Parser $parser * @param string $string - * @param int $length + * @param string $length * @param string $padding * @param int $direction * @return string @@ -897,7 +897,12 @@ class CoreParserFunctions { } # The remaining length to add counts down to 0 as padding is added - $length = min( $length, 500 ) - mb_strlen( $string ); + $length = min( (int)$length, 500 ) - mb_strlen( $string ); + if ( $length <= 0 ) { + // Nothing to add + return $string; + } + # $finalPadding is just $padding repeated enough times so that # mb_strlen( $string ) + mb_strlen( $finalPadding ) == $length $finalPadding = ''; @@ -1339,7 +1344,7 @@ class CoreParserFunctions { foreach ( $sources[0] as $sourceTitle ) { $names[] = $sourceTitle->getPrefixedText(); } - return implode( $names, '|' ); + return implode( '|', $names ); } return ''; }