Last modified: 2006-08-21 11:08:27 UTC
Minor PHP warning with string padding, wiki text is: ========================== {{padright:||||||||}} ========================== HTML output on a wiki with error_reporting(E_ALL) includes: ========================== <b>Warning</b>: str_pad() [<a href='function.str-pad'>function.str-pad</a>]: Padding string cannot be empty. in <b>/var/www/hosts/mediawiki/phase3/includes/CoreParserFunctions.php</b> on line <b>155</b><br /> ========================== Maybe just return $string when the padding value is empty? e.g. something roughly like: ========================== function padright( $parser, $string = '', $length = 0, $char = 0 ) { if ((string)$char) { return str_pad( $string, $length, (string)$char, STR_PAD_RIGHT ); } else { return $string; } } ========================== ... or perhaps in this situation just set it to a generally acceptable default: ========================== if (!(string)$char) $char = "0"; return str_pad( $string, $length, (string)$char, STR_PAD_RIGHT ); ==========================
Fixed in SVN trunk, r16152.