Verified Commit 46ee6c8e authored by Lee Rowlands's avatar Lee Rowlands
Browse files

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 bb5f6e56
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
    }
  }

+3 −0
Original line number Diff line number Diff line
@@ -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],
    ];
  }