add try catch to handle invalid value

This commit is contained in:
iBNu Maksum
2024-10-17 13:38:50 +07:00
parent 97296abf06
commit 234e5e3967
2 changed files with 21 additions and 5 deletions

View File

@ -333,10 +333,25 @@ $unpaid = ORM::for_table('tbl_payment_gateway')
->find_one();
// check expired payments
if($unpaid && (strtotime($unpaid['expired_date']) < time() || strtotime($unpaid['created_date'], "+24 HOUR") < time())){
$unpaid->status = 4;
$unpaid->save();
$unpaid = [];
if ($unpaid) {
try {
if (strtotime($unpaid['expired_date']) < time()) {
$unpaid->status = 4;
$unpaid->save();
$unpaid = [];
}
} catch (Throwable $e) {
} catch (Exception $e) {
}
try {
if (strtotime($unpaid['created_date'], "+24 HOUR") < time()) {
$unpaid->status = 4;
$unpaid->save();
$unpaid = [];
}
} catch (Throwable $e) {
} catch (Exception $e) {
}
}
$ui->assign('unpaid', $unpaids);