From: Brion Vibber Date: Sun, 23 Aug 2009 23:27:32 +0000 (+0000) Subject: * (bug 20364) Fixed regression in GIF metadata loading X-Git-Tag: 1.31.0-rc.0~40085 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/?a=commitdiff_plain;h=2807a6df29e0601baf603b85e13def8da407948c;p=lhc%2Fweb%2Fwiklou.git * (bug 20364) Fixed regression in GIF metadata loading There was a missing parameter in GIFMetadataExtractor's skipBlock() call for 'netscape 2.0' data blocks, which threw a monkey in the works. Now also checking for exceptions thrown by the metadata load and stubbing out null metadata for files which can't be read, rather than letting the exception bubble up and kill MediaWiki. :) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2bf5b9b9e1..409712e88e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -427,6 +427,7 @@ this. Was used when mwEmbed was going to be an extension. target page * (bug 20365) Page name with with c/g/h/j/s/u + x are now correctly handled in Special:MovePage with Esperanto as content language +* (bug 20364) Fixed regression in GIF metadata loading == API changes in 1.16 == diff --git a/includes/media/GIF.php b/includes/media/GIF.php index 1c6dde81fd..dbe5f81309 100644 --- a/includes/media/GIF.php +++ b/includes/media/GIF.php @@ -12,8 +12,15 @@ class GIFHandler extends BitmapHandler { function getMetadata( $image, $filename ) { - if ( !isset($image->parsedGIFMetadata) ) - $image->parsedGIFMetadata = GIFMetadataExtractor::getMetadata( $filename ); + if ( !isset($image->parsedGIFMetadata) ) { + try { + $image->parsedGIFMetadata = GIFMetadataExtractor::getMetadata( $filename ); + } catch( Exception $e ) { + // Broken file? + wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" ); + return '0'; + } + } return serialize($image->parsedGIFMetadata); diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index 0e9c62bf7e..fac9012b50 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -101,7 +101,7 @@ class GIFMetadataExtractor { // NETSCAPE2.0 (application name) if ($blockLength != 11 || $data != 'NETSCAPE2.0') { fseek( $fh, -($blockLength + 1), SEEK_CUR ); - self::skipBlock(); + self::skipBlock( $fh ); continue; }