X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=blobdiff_plain;f=includes%2Fparser%2FCoreParserFunctions.php;h=1ff8859cfb96d35f77490abac3761bf0523c1211;hb=dc96f656affd1f8fab0ae72b0d96e77055e5b336;hp=c6a10aefbc0be868c2c529378c9b154e83b8b757;hpb=6b3e5511fb848890f174690885e748b90389c0b8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index c6a10aefbc..1ff8859cfb 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 = ''; @@ -1059,7 +1064,7 @@ class CoreParserFunctions { $name = trim( $frame->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) ); $value = trim( $frame->expand( $bits['value'] ) ); if ( preg_match( '/^(?:["\'](.+)["\']|""|\'\')$/s', $value, $m ) ) { - $value = isset( $m[1] ) ? $m[1] : ''; + $value = $m[1] ?? ''; } $attributes[$name] = $value; } @@ -1339,7 +1344,7 @@ class CoreParserFunctions { foreach ( $sources[0] as $sourceTitle ) { $names[] = $sourceTitle->getPrefixedText(); } - return implode( $names, '|' ); + return implode( '|', $names ); } return ''; }