mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Replace methods with safe variants. Let's see how this works out.
This commit is contained in:
@@ -130,7 +130,7 @@ class ForcesDecimalSize extends Command
|
||||
// if sqlite, add function?
|
||||
if ('sqlite' === (string) config('database.default')) {
|
||||
DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value) {
|
||||
mb_regex_encoding('UTF-8');
|
||||
\Safe\mb_regex_encoding('UTF-8');
|
||||
$pattern = trim($pattern, '"');
|
||||
|
||||
return (false !== mb_ereg($pattern, (string) $value)) ? 1 : 0;
|
||||
@@ -234,7 +234,7 @@ class ForcesDecimalSize extends Command
|
||||
/** @var Builder $query */
|
||||
$query = Account::leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
;
|
||||
$query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
@@ -338,7 +338,7 @@ class ForcesDecimalSize extends Command
|
||||
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
$q->orWhere(
|
||||
@@ -394,7 +394,7 @@ class ForcesDecimalSize extends Command
|
||||
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
$q->orWhere(
|
||||
@@ -448,7 +448,7 @@ class ForcesDecimalSize extends Command
|
||||
$query = PiggyBank::leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', 'currency_id')
|
||||
->where('account_meta.data', json_encode((string) $currency->id))
|
||||
->where('account_meta.data', \Safe\json_encode((string) $currency->id))
|
||||
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
|
||||
foreach ($fields as $field) {
|
||||
$q->orWhere(
|
||||
|
@@ -111,8 +111,8 @@ class OutputsInstructions extends Command
|
||||
*/
|
||||
private function showLogo(): void
|
||||
{
|
||||
$today = date('m-d');
|
||||
$month = date('m');
|
||||
$today = \Safe\date('m-d');
|
||||
$month = \Safe\date('m');
|
||||
// variation in colors and effects just because I can!
|
||||
// default is Ukraine flag:
|
||||
$colors = ['blue', 'blue', 'blue', 'yellow', 'yellow', 'yellow', 'default', 'default'];
|
||||
|
@@ -63,15 +63,15 @@ class ScansAttachments extends Command
|
||||
app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
|
||||
$decryptedContent = $encryptedContent;
|
||||
}
|
||||
$tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');
|
||||
$tempFileName = \Safe\tempnam(sys_get_temp_dir(), 'FireflyIII');
|
||||
if (false === $tempFileName) {
|
||||
app('log')->error(sprintf('Could not create temporary file for attachment #%d', $attachment->id));
|
||||
|
||||
exit(1);
|
||||
}
|
||||
file_put_contents($tempFileName, $decryptedContent);
|
||||
$attachment->md5 = (string) md5_file($tempFileName);
|
||||
$attachment->mime = (string) mime_content_type($tempFileName);
|
||||
\Safe\file_put_contents($tempFileName, $decryptedContent);
|
||||
$attachment->md5 = (string) \Safe\md5_file($tempFileName);
|
||||
$attachment->mime = (string) \Safe\mime_content_type($tempFileName);
|
||||
$attachment->save();
|
||||
$this->friendlyInfo(sprintf('Fixed attachment #%d', $attachment->id));
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
$content = $disk->get('alerts.json');
|
||||
$json = json_decode($content, true, 10);
|
||||
$json = \Safe\json_decode($content, true, 10);
|
||||
|
||||
/** @var array $array */
|
||||
foreach ($json as $array) {
|
||||
|
Reference in New Issue
Block a user