* Fix fatal error when specifying illegal name for manual thumbnail
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 3 Jun 2006 00:24:04 +0000 (00:24 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 3 Jun 2006 00:24:04 +0000 (00:24 +0000)
RELEASE-NOTES
includes/Linker.php
maintenance/parserTests.txt

index 113f33e..993e0f5 100644 (file)
@@ -415,6 +415,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 6171) Fix sanitizing of HTML-elements with an optional closing
   tag. The sanitizer still needs to learn how to make well-formed XML
   in this case.
+* Fix fatal error when specifying illegal name for manual thumbnail
+
 
 == Compatibility ==
 
index 30d0a31..44d1799 100644 (file)
@@ -603,15 +603,17 @@ class Linker {
                if ( $manual_thumb != '' ) # Use manually specified thumbnail
                {
                        $manual_title = Title::makeTitleSafe( NS_IMAGE, $manual_thumb ); #new Title ( $manual_thumb ) ;
-                       $manual_img = new Image( $manual_title );
-                       $thumbUrl = $manual_img->getViewURL();
-                       if ( $manual_img->exists() )
-                       {
-                               $width  = $manual_img->getWidth();
-                               $height = $manual_img->getHeight();
-                               $boxwidth = $width ;
-                               $boxheight = $height ;
-                               $oboxwidth = $boxwidth + 2 ;
+                       if( $manual_title ) {
+                               $manual_img = new Image( $manual_title );
+                               $thumbUrl = $manual_img->getViewURL();
+                               if ( $manual_img->exists() )
+                               {
+                                       $width  = $manual_img->getWidth();
+                                       $height = $manual_img->getHeight();
+                                       $boxwidth = $width ;
+                                       $boxheight = $height ;
+                                       $oboxwidth = $boxwidth + 2 ;
+                               }
                        }
                }
 
index 05b67ba..5158a16 100644 (file)
@@ -4293,6 +4293,15 @@ http://example.com<pre>junk</pre>
 
 !!end
 
+!!test
+Fuzz testing: image with bogus manual thumbnail
+!!input
+[[Image:foobar.jpg|thumbnail= ]]
+!!result
+<div class="thumb tright"><div style="width:182px;"><a href="/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="/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>
+
+!!end
+
 !! test
 Parsing optional HTML elements (Bug 6171)
 !! options