Cast empty values for the file size to int
authorAlexander Ebert <ebert@woltlab.com>
Mon, 19 Jul 2021 15:32:25 +0000 (17:32 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 19 Jul 2021 15:32:25 +0000 (17:32 +0200)
PHP 8 is much more sensitive to type mismatches, before PHP 8 the value `''` was implicitly converted to `0`.

wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php

index 4643eb375f1735b3e82050ae1cc079bbd9244d76..af6e0692506ac84062cd808f1e2e058dfac5c6e1 100644 (file)
@@ -77,7 +77,7 @@ class FileSizeOptionType extends TextOptionType
      */
     public function getFormElement(Option $option, $value)
     {
-        $value = FileUtil::formatFilesize($value);
+        $value = FileUtil::formatFilesize(intval($value));
 
         return parent::getFormElement($option, $value);
     }