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

@@ -240,8 +240,8 @@ class General extends AbstractExtension
return new TwigFilter(
'phphost',
static function (string $string): string {
$proto = (string) parse_url($string, PHP_URL_SCHEME);
$host = (string) parse_url($string, PHP_URL_HOST);
$proto = (string) \Safe\parse_url($string, PHP_URL_SCHEME);
$host = (string) \Safe\parse_url($string, PHP_URL_HOST);
return e(sprintf('%s://%s', $proto, $host));
}
@@ -272,7 +272,7 @@ class General extends AbstractExtension
return new TwigFunction(
'phpdate',
static function (string $str): string {
return date($str);
return \Safe\date($str);
}
);
}

View File

@@ -254,7 +254,7 @@ class TransactionGroupTwig extends AbstractExtension
return today(config('app.timezone'));
}
return new Carbon(json_decode($entry->data, false));
return new Carbon(\Safe\json_decode($entry->data, false));
}
);
}
@@ -275,7 +275,7 @@ class TransactionGroupTwig extends AbstractExtension
return '';
}
return json_decode($entry->data, true);
return \Safe\json_decode($entry->data, true);
}
);
}