From: Tim Düsterhus Date: Mon, 12 Dec 2011 14:09:17 +0000 (+0100) Subject: Match floating point numbers as well X-Git-Tag: 2.0.0_Beta_1~1485^2~2^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c4f94b3c6e758d437fa5d0e9bab12118e5a99803;p=GitHub%2FWoltLab%2FWCF.git Match floating point numbers as well Valid numbers are (when . is the decimal-point): 1024 1.02 .5 --- diff --git a/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php b/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php index 0d20ef10c7..f647c6b71e 100644 --- a/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php @@ -1,6 +1,7 @@ get('wcf.global.thousandsSeparator'), '', $newValue); + $d = preg_quote(WCF::getLanguage()->get('wcf.global.decimalPoint'), '~'); + if (!preg_match('~^(?:\d*)(?:'.$d.')?\d+~', $number, $matches)) return 0; + + $number = $matches[0]; if (preg_match('/[kmgt]i?b$/i', $newValue, $multiplier)) { switch (StringUtil::toLowerCase($multiplier[0])) { case 'tb':