Last modified: 2006-08-21 11:08:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T9081, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7081 - PHP warning with error_reporting(E_ALL) on empty padding input to {{padleft}} / {{padright}}
PHP warning with error_reporting(E_ALL) on empty padding input to {{padleft}}...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.8.x
All All
: Low minor (vote)
: ---
Assigned To: Rob Church
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-21 05:24 UTC by Nick Jenkins
Modified: 2006-08-21 11:08 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Nick Jenkins 2006-08-21 05:24:11 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 );
==========================
Comment 1 Rob Church 2006-08-21 11:08:27 UTC
Fixed in SVN trunk, r16152.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links