Leave some FIXME comments for Bug 36911 - Division by zero
authorReedy <reedy@wikimedia.org>
Thu, 6 Dec 2012 23:59:18 +0000 (23:59 +0000)
committerReedy <reedy@wikimedia.org>
Thu, 6 Dec 2012 23:59:18 +0000 (23:59 +0000)
Change-Id: I994c482cad1d195cf29d18f7ccf1d8816b1e7330

includes/ImagePage.php

index 316e1c9..ecf4f89 100644 (file)
@@ -340,13 +340,13 @@ class ImagePage extends Article {
                                if ( $width > $maxWidth || $height > $maxHeight ) {
                                        # Calculate the thumbnail size.
                                        # First case, the limiting factor is the width, not the height.
-                                       if ( $width / $height >= $maxWidth / $maxHeight ) {
-                                               $height = round( $height * $maxWidth / $width );
+                                       if ( $width / $height >= $maxWidth / $maxHeight ) { // FIXME: Possible divison by 0. bug 36911
+                                               $height = round( $height * $maxWidth / $width ); // FIXME: Possible divison by 0. bug 36911
                                                $width = $maxWidth;
                                                # Note that $height <= $maxHeight now.
                                        } else {
-                                               $newwidth = floor( $width * $maxHeight / $height );
-                                               $height = round( $height * $newwidth / $width );
+                                               $newwidth = floor( $width * $maxHeight / $height ); // FIXME: Possible divison by 0. bug 36911
+                                               $height = round( $height * $newwidth / $width ); // FIXME: Possible divison by 0. bug 36911
                                                $width = $newwidth;
                                                # Note that $height <= $maxHeight now, but might not be identical
                                                # because of rounding.