parent
717669ed4a
commit
c9c59b3f03
|
@ -33,17 +33,19 @@ class MemoryLimit
|
||||||
public static function parsePhpIniByteString($string)
|
public static function parsePhpIniByteString($string)
|
||||||
{
|
{
|
||||||
$val = trim($string);
|
$val = trim($string);
|
||||||
$last = strtoupper(substr($val, -1, 1));
|
|
||||||
|
|
||||||
switch ($last) {
|
if (preg_match('/^(\d+)([KMG])$/', $val, $m)) {
|
||||||
case 'G':
|
$val = $m[1];
|
||||||
$val *= 1024;
|
switch ($m[2]) {
|
||||||
|
case 'G':
|
||||||
|
$val *= 1024;
|
||||||
// Intentional fall-through
|
// Intentional fall-through
|
||||||
case 'M':
|
case 'M':
|
||||||
$val *= 1024;
|
$val *= 1024;
|
||||||
// Intentional fall-through
|
// Intentional fall-through
|
||||||
case 'K':
|
case 'K':
|
||||||
$val *= 1024;
|
$val *= 1024;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return intval($val);
|
return intval($val);
|
||||||
|
|
Loading…
Reference in New Issue