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

@@ -242,7 +242,7 @@ class DebugController extends Controller
if ($handler instanceof RotatingFileHandler) {
$logFile = $handler->getUrl();
if (null !== $logFile && file_exists($logFile)) {
$logContent = file_get_contents($logFile);
$logContent = \Safe\file_get_contents($logFile);
}
}
}
@@ -267,8 +267,8 @@ class DebugController extends Controller
private function getSystemInformation(): array
{
$maxFileSize = Steam::phpBytes((string) ini_get('upload_max_filesize'));
$maxPostSize = Steam::phpBytes((string) ini_get('post_max_size'));
$maxFileSize = Steam::phpBytes((string) \Safe\ini_get('upload_max_filesize'));
$maxPostSize = Steam::phpBytes((string) \Safe\ini_get('post_max_size'));
$drivers = DB::availableDrivers();
$currentDriver = DB::getDriverName();
@@ -280,8 +280,8 @@ class DebugController extends Controller
'interface' => \PHP_SAPI,
'bits' => \PHP_INT_SIZE * 8,
'bcscale' => bcscale(),
'display_errors' => ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int) ini_get('error_reporting')),
'display_errors' => \Safe\ini_get('display_errors'),
'error_reporting' => $this->errorReporting((int) \Safe\ini_get('error_reporting')),
'upload_size' => min($maxFileSize, $maxPostSize),
'all_drivers' => $drivers,
'current_driver' => $currentDriver,
@@ -300,7 +300,7 @@ class DebugController extends Controller
try {
if (file_exists('/var/www/counter-main.txt')) {
$return['build'] = trim((string) file_get_contents('/var/www/counter-main.txt'));
$return['build'] = trim((string) \Safe\file_get_contents('/var/www/counter-main.txt'));
app('log')->debug(sprintf('build is now "%s"', $return['build']));
}
} catch (\Exception $e) {
@@ -310,7 +310,7 @@ class DebugController extends Controller
try {
if (file_exists('/var/www/build-date-main.txt')) {
$return['build_date'] = trim((string) file_get_contents('/var/www/build-date-main.txt'));
$return['build_date'] = trim((string) \Safe\file_get_contents('/var/www/build-date-main.txt'));
}
} catch (\Exception $e) {
app('log')->debug('Could not check build date, but thats ok.');