Replace methods with safe variants. Let's see how this works out.

This commit is contained in:
James Cole
2025-05-04 12:11:25 +02:00
parent fb31f25d71
commit 446e855b74
71 changed files with 480 additions and 353 deletions

View File

@@ -55,7 +55,7 @@ class MailError extends Job implements ShouldQueue
$debug = $exceptionData;
unset($debug['stackTrace'], $debug['headers']);
app('log')->error(sprintf('Exception is: %s', json_encode($debug)));
app('log')->error(sprintf('Exception is: %s', \Safe\json_encode($debug)));
}
/**
@@ -126,11 +126,11 @@ class MailError extends Job implements ShouldQueue
if (!file_exists($file)) {
Log::debug(sprintf('Wrote new file in "%s"', $file));
file_put_contents($file, json_encode($limits, JSON_PRETTY_PRINT));
\Safe\file_put_contents($file, \Safe\json_encode($limits, JSON_PRETTY_PRINT));
}
if (file_exists($file)) {
Log::debug(sprintf('Read file in "%s"', $file));
$limits = json_decode((string) file_get_contents($file), true);
$limits = \Safe\json_decode((string) \Safe\file_get_contents($file), true);
}
// limit reached?
foreach ($types as $type => $info) {
@@ -158,7 +158,7 @@ class MailError extends Job implements ShouldQueue
}
++$limits[$type]['sent'];
}
file_put_contents($file, json_encode($limits, JSON_PRETTY_PRINT));
\Safe\file_put_contents($file, \Safe\json_encode($limits, JSON_PRETTY_PRINT));
Log::debug('No limits reached, return FALSE.');
return false;