Unverified Commit 14e56915 authored by larowlan's avatar larowlan

Issue #3156879 by alexpott, Krzysztof Domański:...

Issue #3156879 by alexpott, Krzysztof Domański: \Drupal\Component\Utility\Bytes::toInt() - ensure $size is a number type

(cherry picked from commit ff722653)
parent fcb2e87d
......@@ -35,7 +35,8 @@ public static function toInt($size) {
return round($size * pow(self::KILOBYTE, stripos('bkmgtpezy', $unit[0])));
}
else {
return round($size);
// Ensure size is a proper number type.
return round((float) $size);
}
}
......
......@@ -56,6 +56,9 @@ public function providerTestToInt() {
['76MRandomStringThatShouldBeIgnoredByParseSize.', 79691776],
// 76.24 GB (with typo).
['76.24 Giggabyte', 81862076662],
['1.5', 2],
['2.4', 2],
['', 0],
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment