fix: cut bytestring into numeric part

This commit is contained in:
Marvin Flock
2025-03-10 19:38:10 +01:00
parent d4c7bbc183
commit b776cea826
@@ -116,20 +116,19 @@ function setMinMemoryLimit($memDestSize) {
} }
function getBytes($val) { function getBytes($val) {
if (is_numeric($val)) {
$val = trim($val); $val = trim($val);
$last = strtolower($val[strlen($val) - 1]); $numeric = substr($val, 0, strlen($val) -1);
switch ($last) { $last = strtolower($val[strlen($val) - 1]);
switch($last) {
// The 'G' modifier is available since PHP 5.1.0 // The 'G' modifier is available since PHP 5.1.0
case 'g': case 'g':
$val *= 1024; $numeric *= 1024;
case 'm': case 'm':
$val *= 1024; $numeric *= 1024;
case 'k': case 'k':
$val *= 1024; $numeric *= 1024;
}
return $val;
} }
return $numeric;
} }
function encrypt($str, $key){ function encrypt($str, $key){