Skip to content

Commit

Permalink
Remove check for ini_parse_quantity
Browse files Browse the repository at this point in the history
This is now provided by Symfony's polyfill.
  • Loading branch information
TimWolla committed Aug 28, 2023
1 parent 4b86403 commit 76b16ba
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions wcfsetup/install/files/lib/util/FileUtil.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,30 +516,8 @@ public static function getMemoryLimit(): int
// 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);
}
}

Expand Down

0 comments on commit 76b16ba

Please sign in to comment.