From cc8e5f7116b1735f35a15785aaf6cc4f9384b2b8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 20 Jun 2024 12:50:25 +0200 Subject: [PATCH] `\ini_parse_quantity()` is provided by the Symfony polyfill MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reintroduces the changes made in 76b16ba4e89a7ff46cc2e1f79a158afc1c5e4c40 which was reverted in 5d52de11b680078012eba04ae983058e6086b7d7 due to a bug in an earlier version of Symphony’s polyfill. --- .../install/files/lib/util/FileUtil.class.php | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) 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); } } -- 2.20.1