Merge "phpunit: Replace APC with HashBagOStuff during a test"
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index 4070553..4c9c2aa 100644 (file)
@@ -456,7 +456,7 @@ class LocalFile extends File {
        }
 
        /**
-        * @param array $row Row
+        * @param array|object $row
         * @param string $prefix
         * @throws MWException
         * @return array
@@ -502,9 +502,17 @@ class LocalFile extends File {
                        $decoded['mime'] = $decoded['major_mime'] . '/' . $decoded['minor_mime'];
                }
 
-               # Trim zero padding from char/binary field
+               // Trim zero padding from char/binary field
                $decoded['sha1'] = rtrim( $decoded['sha1'], "\0" );
 
+               // Normalize some fields to integer type, per their database definition.
+               // Use unary + so that overflows will be upgraded to double instead of
+               // being trucated as with intval(). This is important to allow >2GB
+               // files on 32-bit systems.
+               foreach ( array( 'size', 'width', 'height', 'bits' ) as $field ) {
+                       $decoded[$field] = +$decoded[$field];
+               }
+
                return $decoded;
        }