Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / includes / media / Bitmap.php
index 617a910..b88a34d 100644 (file)
@@ -203,9 +203,9 @@ class BitmapHandler extends TransformationalImageHandler {
                                '-layers', 'merge',
                                '-background', 'white',
                        ];
-                       MediaWiki\suppressWarnings();
+                       Wikimedia\suppressWarnings();
                        $xcfMeta = unserialize( $image->getMetadata() );
-                       MediaWiki\restoreWarnings();
+                       Wikimedia\restoreWarnings();
                        if ( $xcfMeta
                                && isset( $xcfMeta['colorType'] )
                                && $xcfMeta['colorType'] === 'greyscale-alpha'
@@ -440,6 +440,14 @@ class BitmapHandler extends TransformationalImageHandler {
                        return $this->getMediaTransformError( $params, $errMsg );
                }
 
+               if ( filesize( $params['srcPath'] ) === 0 ) {
+                       $err = "Image file size seems to be zero.";
+                       wfDebug( "$err\n" );
+                       $errMsg = wfMessage( 'thumbnail_image-size-zero', $params['srcPath'] )->text();
+
+                       return $this->getMediaTransformError( $params, $errMsg );
+               }
+
                $src_image = call_user_func( $loader, $params['srcPath'] );
 
                $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ?