Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -381,7 +381,11 @@ |
382 | 382 | static function pad( $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) { |
383 | 383 | $lengthOfPadding = mb_strlen( $padding ); |
384 | 384 | if ( $lengthOfPadding == 0 ) return $string; |
385 | | - if ( $length < mb_strlen( $string ) ) return $string; |
| 385 | + |
| 386 | + // Thwart attempts to use this function to truncate strings. |
| 387 | + // We don't want people implementing ParserFunctions in template, |
| 388 | + // for performance and usability reasons. |
| 389 | + if ($lengthOfPadding > $length && $string == '') return $string; |
386 | 390 | |
387 | 391 | # The remaining length to add counts down to 0 as padding is added |
388 | 392 | $length = min( $length, 500 ) - mb_strlen( $string ); |