PHP typing strikes again! Padding parser functions now work with strings like '0...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 11 Jul 2007 05:40:05 +0000 (05:40 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 11 Jul 2007 05:40:05 +0000 (05:40 +0000)
RELEASE-NOTES
includes/CoreParserFunctions.php

index 01d051d..55dd1a1 100644 (file)
@@ -275,6 +275,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   the intended skin directly in the URL.
 * (bug 9903) Don't mark redirects in categories as stubs
 * (bug 6965) Cannot include "Template:R" with {{R}} (magic word conflict)
+* Padding parser functions now work with strings like '0' that evaluate to false
 
 == API changes since 1.10 ==
 
index 261452a..a5f4501 100644 (file)
@@ -161,7 +161,7 @@ class CoreParserFunctions {
        static function pad( $string = '', $length = 0, $char = 0, $direction = STR_PAD_RIGHT ) {
                $length = min( max( $length, 0 ), 500 );
                $char = substr( $char, 0, 1 );
-               return ( $string && (int)$length > 0 && strlen( trim( (string)$char ) ) > 0 )
+               return ( $string !== '' && (int)$length > 0 && strlen( trim( (string)$char ) ) > 0 )
                                ? str_pad( $string, $length, (string)$char, $direction )
                                : $string;
        }