r14544 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14543‎ | r14544 | r14545 >
Date:00:24, 3 June 2006
Author:brion
Status:old
Tags:
Comment:
* Fix fatal error when specifying illegal name for manual thumbnail
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -4293,6 +4293,15 @@
42944294
42954295 !!end
42964296
 4297+!!test
 4298+Fuzz testing: image with bogus manual thumbnail
 4299+!!input
 4300+[[Image:foobar.jpg|thumbnail= ]]
 4301+!!result
 4302+<div class="thumb tright"><div style="width:182px;"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="180" height="-1" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="https://www.mediawiki.org/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div></div></div></div>
 4303+
 4304+!!end
 4305+
42974306 !! test
42984307 Parsing optional HTML elements (Bug 6171)
42994308 !! options
Index: trunk/phase3/includes/Linker.php
@@ -603,15 +603,17 @@
604604 if ( $manual_thumb != '' ) # Use manually specified thumbnail
605605 {
606606 $manual_title = Title::makeTitleSafe( NS_IMAGE, $manual_thumb ); #new Title ( $manual_thumb ) ;
607 - $manual_img = new Image( $manual_title );
608 - $thumbUrl = $manual_img->getViewURL();
609 - if ( $manual_img->exists() )
610 - {
611 - $width = $manual_img->getWidth();
612 - $height = $manual_img->getHeight();
613 - $boxwidth = $width ;
614 - $boxheight = $height ;
615 - $oboxwidth = $boxwidth + 2 ;
 607+ if( $manual_title ) {
 608+ $manual_img = new Image( $manual_title );
 609+ $thumbUrl = $manual_img->getViewURL();
 610+ if ( $manual_img->exists() )
 611+ {
 612+ $width = $manual_img->getWidth();
 613+ $height = $manual_img->getHeight();
 614+ $boxwidth = $width ;
 615+ $boxheight = $height ;
 616+ $oboxwidth = $boxwidth + 2 ;
 617+ }
616618 }
617619 }
618620
Index: trunk/phase3/RELEASE-NOTES
@@ -415,7 +415,9 @@
416416 * (bug 6171) Fix sanitizing of HTML-elements with an optional closing
417417 tag. The sanitizer still needs to learn how to make well-formed XML
418418 in this case.
 419+* Fix fatal error when specifying illegal name for manual thumbnail
419420
 421+
420422 == Compatibility ==
421423
422424 MediaWiki 1.7 requires PHP 5 (5.1 recommended). PHP 4 is no longer supported.

Status & tagging log