Merge "Leave some FIXME comments for Bug 36911 - Division by zero"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 7 Dec 2012 17:55:39 +0000 (17:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 7 Dec 2012 17:55:39 +0000 (17:55 +0000)
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.