Return immediately if limit is negative
This commit is contained in:
parent
a1160c9cbd
commit
c4f6bc09ac
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue