From 330f20698cc15c76ee29d12005d8c89a69a4ef2f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 2 Oct 2006 19:46:12 +0000 Subject: [PATCH] * (bug 6889) PHP notices in thumb.php with missing params --- RELEASE-NOTES | 1 + thumb.php | 28 +++++----------------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 22babed168..7535f75798 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -252,6 +252,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 7460) Revert broken patch for bug 7226 which slows down 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 == Languages updated == diff --git a/thumb.php b/thumb.php index 545f64435d..4ec40dc3f0 100644 --- a/thumb.php +++ b/thumb.php @@ -17,30 +17,17 @@ require_once( 'Image.php' ); require_once( 'StreamFile.php' ); // Get input parameters -$p=null; +$fileName = isset( $_REQUEST['f'] ) ? $_REQUEST['f'] : ''; +$width = isset( $_REQUEST['w'] ) ? intval( $_REQUEST['w'] ) : 0; +$page = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : null; if ( get_magic_quotes_gpc() ) { - $fileName = stripslashes( $_REQUEST['f'] ); - $width = stripslashes( $_REQUEST['w'] ); - if ( isset( $_REQUEST['p'] ) ) { // optional page number - $page = stripslashes( $_REQUEST['p'] ); - } -} else { - $fileName = $_REQUEST['f']; - $width = $_REQUEST['w']; - if ( isset( $_REQUEST['p'] ) ) { // optional page number - $page = $_REQUEST['p'] ; - } + $fileName = stripslashes( $fileName ); } $pre_render= isset($_REQUEST['r']) && $_REQUEST['r']!="0"; // Some basic input validation - -$width = intval( $width ); -if ( ! is_null( $page ) ) { - $page = intval( $page ); -} $fileName = strtr( $fileName, '\\/', '__' ); // Work out paths, carefully avoiding constructing an Image object because that won't work yet @@ -76,12 +63,7 @@ if ( $img ) { $thumb = false; } -if ( $img->lastError && $img->lastError !== true ) { - header( 'HTTP/1.0 500 Internal Server Error' ); - echo "

Thumbnail generation error

" . - htmlspecialchars( $img->lastError ) . "
" . wfHostname() . - "

"; -} elseif ( $thumb && $thumb->path ) { +if ( $thumb && $thumb->path ) { wfStreamFile( $thumb->path ); } else { $badtitle = wfMsg( 'badtitle' ); -- 2.20.1