From ee7d2a466341df8053cba1f3f6b4766ea4e2530e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 8 Aug 2008 21:50:37 +0000 Subject: [PATCH] Revert r38876 "(bug 2443) Add image name as alt-text when no caption is provided." This broke four test cases: 4 previously failing test(s) now PASSING! :) * Right-aligned image [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now] * Centre-aligned image [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now] * None-aligned image [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now] * Width + Height sized image (using px) (height is ignored) [Fixed between 08-Aug-2008 21:37:38, 1.14alpha (r38954) and now] Please recommit with fixes to the existing test cases and some new test cases to cover cases where an empty caption is explicitly requested, see https://bugzilla.wikimedia.org/show_bug.cgi?id=2443#c11 --- RELEASE-NOTES | 1 - includes/parser/Parser.php | 14 ++++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a036bcd737..3e8f038ab7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -82,7 +82,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN Patch by Max Semenik. * (bug 15055) Talk page notifications no longer attempt to send mail when user's e-mail address is invalid or unconfirmed -* (bug 2443) Add image name as alt-text when no caption is provided. * (bug 12370) Add throttle on password attempts. Defaults to max 5 attempts in 5 minutes. * (bug 15016) 'Templates used on this page' list in view source should be wrapped in a div with class "templatesUsed" diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 0648040296..7a2f5f7134 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4517,7 +4517,7 @@ class Parser list( $paramMap, $mwArray ) = $this->getImageParams( $handler ); # Process the input parameters - $caption = false; + $caption = ''; $params = array( 'frame' => array(), 'handler' => array(), 'horizAlign' => array(), 'vertAlign' => array() ); foreach( $parts as $part ) { @@ -4584,15 +4584,9 @@ class Parser if ( $params['vertAlign'] ) { $params['frame']['valign'] = key( $params['vertAlign'] ); } - - // Process alt text - if ($caption === false) { - // Put the image name in. - $alt = $title->getPrefixedText(); - } else { - # Strip bad stuff out of the alt text - $alt = $this->replaceLinkHoldersText( $caption ); - } + + # Strip bad stuff out of the alt text + $alt = $this->replaceLinkHoldersText( $caption ); # make sure there are no placeholders in thumbnail attributes # that are later expanded to html- so expand them now and -- 2.20.1