Return immediately if limit is negative

This commit is contained in:
Sebastian Meyer 2024-01-11 14:56:00 +01:00
parent a1160c9cbd
commit c4f6bc09ac
1 changed files with 3 additions and 3 deletions

View File

@ -64,6 +64,9 @@ abstract class Console extends Command
{
$ini = trim(ini_get('memory_limit'));
$limit = (int) $ini;
if ($limit < 0) {
return -1;
}
$unit = strtolower($ini[strlen($ini)-1]);
switch($unit) {
case 'g':
@ -73,9 +76,6 @@ abstract class Console extends Command
case 'k':
$limit *= 1024;
}
if ($limit < 0) {
return -1;
}
return $limit;
}