From: Brion Vibber Date: Mon, 2 Oct 2006 21:12:28 +0000 (+0000) Subject: * Cleaner error behavior on thumb.php with invalid page selection X-Git-Tag: 1.31.0-rc.0~55660 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=c8acd3393b8e1b83977ec23246f92a4e4dce02f3;p=lhc%2Fweb%2Fwiklou.git * Cleaner error behavior on thumb.php with invalid page selection --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7535f75798..1e1f8fd21b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -253,6 +253,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN Special:Allmessages by a factor of 16 * Committed a bunch of live hacks from Wikimedia servers * (bug 6889) PHP notices in thumb.php with missing params +* Cleaner error behavior on thumb.php with invalid page selection == Languages updated == diff --git a/includes/Image.php b/includes/Image.php index 25960369dd..48dcc6b6ce 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -2282,7 +2282,9 @@ class Image __METHOD__ ); } + wfSuppressWarnings(); $this->multiPageXML = new SimpleXMLElement( $this->metadata ); + wfRestoreWarnings(); } /** diff --git a/thumb.php b/thumb.php index 4ec40dc3f0..a056dccdac 100644 --- a/thumb.php +++ b/thumb.php @@ -54,12 +54,17 @@ require_once( 'Setup.php' ); wfProfileIn( 'thumb.php-render' ); $img = Image::newFromName( $fileName ); -if ( $img ) { - if ( ! is_null( $page ) ) { - $img->selectPage( $page ); +try { + if ( $img ) { + if ( ! is_null( $page ) ) { + $img->selectPage( $page ); + } + $thumb = $img->renderThumb( $width, false ); + } else { + $thumb = false; } - $thumb = $img->renderThumb( $width, false ); -} else { +} catch( Exception $ex ) { + // Tried to select a page on a non-paged file? $thumb = false; }