From: Alexander Ebert Date: Thu, 20 Jun 2024 10:50:25 +0000 (+0200) Subject: `\ini_parse_quantity()` is provided by the Symfony polyfill X-Git-Tag: 6.1.0_Alpha_1~4^2~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cc8e5f7116b1735f35a15785aaf6cc4f9384b2b8;p=GitHub%2FWoltLab%2FWCF.git `\ini_parse_quantity()` is provided by the Symfony polyfill This reintroduces the changes made in 76b16ba4e89a7ff46cc2e1f79a158afc1c5e4c40 which was reverted in 5d52de11b680078012eba04ae983058e6086b7d7 due to a bug in an earlier version of Symphony’s polyfill. --- diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index e7a86de3e5..052e65f265 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -521,30 +521,8 @@ final class FileUtil // no limit if ($memoryLimit == "-1") { self::$memoryLimit = -1; - } else if (\function_exists('ini_parse_quantity')) { - self::$memoryLimit = \ini_parse_quantity($memoryLimit); } else { - // completely numeric, PHP assumes byte - if (\is_numeric($memoryLimit)) { - self::$memoryLimit = $memoryLimit; - } - - // PHP supports 'K', 'M' and 'G' shorthand notation - if (\preg_match('~^(\d+)\s*([KMG])$~i', $memoryLimit, $matches)) { - switch (\strtoupper($matches[2])) { - case 'K': - self::$memoryLimit = $matches[1] * 1024; - break; - - case 'M': - self::$memoryLimit = $matches[1] * 1024 * 1024; - break; - - case 'G': - self::$memoryLimit = $matches[1] * 1024 * 1024 * 1024; - break; - } - } + self::$memoryLimit = \ini_parse_quantity($memoryLimit); } }