r47411 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47410‎ | r47411 | r47412 >
Date:02:24, 18 February 2009
Author:brion
Status:ok
Tags:
Comment:
Revert r46628, r46639 for now "Don't allow padding parser functions to be used to truncate strings."
Doesn't seem to be a compelling reason to add this special-case restriction at this time, and there appear to be ways to work around it anyway, so let's not play the arms race. :)
Modified paths:
  • /trunk/phase3/includes/parser/CoreParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/CoreParserFunctions.php
@@ -473,11 +473,6 @@
474474 static function pad( $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
475475 $lengthOfPadding = mb_strlen( $padding );
476476 if ( $lengthOfPadding == 0 ) return $string;
477 -
478 - // Thwart attempts to use this function to truncate strings.
479 - // We don't want people implementing ParserFunctions in template,
480 - // for performance and usability reasons.
481 - if ($lengthOfPadding > $length && $string == '') return $string;
482477
483478 # The remaining length to add counts down to 0 as padding is added
484479 $length = min( $length, 500 ) - mb_strlen( $string );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r46628Don't allow padding parser functions to be used to truncate strings. This bre...werdna00:46, 31 January 2009
r46639Fix r46628 -- I'd misunderstood the nature of the hack. People wanted to appe...werdna11:43, 31 January 2009

Status & tagging log