jenkins-bot has submitted this change and it was merged.
Change subject: In LocalFile normalize integer fields to integers
......................................................................
In LocalFile normalize integer fields to integers
File::getWidth() etc. should return an integer not a numeric string.
Bug: T111089
Change-Id: Ic767fb6cf3db0be9810b7bfa369c209ec05a6e58
---
M includes/filerepo/file/LocalFile.php
1 file changed, 9 insertions(+), 1 deletion(-)
Approvals:
Ori.livneh: Looks good to me, approved
Subramanya Sastry: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/includes/filerepo/file/LocalFile.php
b/includes/filerepo/file/LocalFile.php
index 4070553..d2c37e6 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -502,9 +502,17 @@
$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;
}
--
To view, visit https://gerrit.wikimedia.org/r/235406
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic767fb6cf3db0be9810b7bfa369c209ec05a6e58
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits