Sanity check on number.

This commit is contained in:
James Cole
2024-01-06 14:23:20 +01:00
parent 7e62b75b12
commit 935634e487

View File

@@ -202,7 +202,9 @@ class BudgetLimitController extends Controller
if ('' === $amount) {
$amount = '0';
}
if ((int)$amount > 268435456) { // 268 million, intentional integer
$amount = '268435456';
}
// sanity check on amount:
if (0 === bccomp($amount, '0')) {
$budgetId = $budgetLimit->budget_id;
@@ -217,9 +219,7 @@ class BudgetLimitController extends Controller
return response()->json($array);
}
if ((int)$amount > 268435456) { // 268 million, intentional integer
$amount = '268435456';
}
if (-1 === bccomp($amount, '0')) {
$amount = bcmul($amount, '-1');
}