Rétablir la compatibilité avec PHP 8.2
This commit is contained in:
parent
9a2b4068da
commit
63224d8b06
12 changed files with 16 additions and 16 deletions
|
|
@ -215,7 +215,7 @@ final class AccountingController
|
|||
if (($f['error'] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK || ($f['size'] ?? 0) > 20 * 1024 * 1024) {
|
||||
throw new RuntimeException(t('accounting.document_invalid'));
|
||||
}
|
||||
$mime = new finfo(FILEINFO_MIME_TYPE)->file($f['tmp_name']);
|
||||
$mime = (new finfo(FILEINFO_MIME_TYPE))->file($f['tmp_name']);
|
||||
$ext =
|
||||
['application/pdf' => 'pdf', 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/webp' => 'webp'][$mime] ??
|
||||
null;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ final class GrantsController
|
|||
header('Location: /admin/grants?year=' . $year . '&error=document');
|
||||
return;
|
||||
}
|
||||
$mime = new finfo(FILEINFO_MIME_TYPE)->file($f['tmp_name']) ?: 'application/octet-stream';
|
||||
$mime = (new finfo(FILEINFO_MIME_TYPE))->file($f['tmp_name']) ?: 'application/octet-stream';
|
||||
$allowed = ['application/pdf' => 'pdf', 'application/vnd.oasis.opendocument.text' => 'odt'];
|
||||
if (!isset($allowed[$mime])) {
|
||||
header('Location: /admin/grants?year=' . $year . '&error=format');
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ final class MedicalDocumentsController
|
|||
if (($f['error'] ?? 1) !== UPLOAD_ERR_OK || ($f['size'] ?? 0) <= 0 || $f['size'] > self::MAX_BYTES) {
|
||||
throw new RuntimeException(t('medical_document.file_invalid'));
|
||||
}
|
||||
$mime = new finfo(FILEINFO_MIME_TYPE)->file($f['tmp_name']);
|
||||
$mime = (new finfo(FILEINFO_MIME_TYPE))->file($f['tmp_name']);
|
||||
if (!isset(self::TYPES[$mime])) {
|
||||
throw new RuntimeException(t('medical_document.file_type'));
|
||||
}
|
||||
|
|
@ -319,7 +319,7 @@ final class MedicalDocumentsController
|
|||
}
|
||||
private static function fr(string $date): string
|
||||
{
|
||||
return new DateTimeImmutable($date)->format('d/m/Y');
|
||||
return (new DateTimeImmutable($date))->format('d/m/Y');
|
||||
}
|
||||
private static function fail(string $message): void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ final class PublicSiteController
|
|||
http_response_code(404);
|
||||
return;
|
||||
}
|
||||
$mime = new finfo(FILEINFO_MIME_TYPE)->file($path) ?: 'application/octet-stream';
|
||||
$mime = (new finfo(FILEINFO_MIME_TYPE))->file($path) ?: 'application/octet-stream';
|
||||
header('Content-Type: ' . $mime);
|
||||
header('Content-Length: ' . filesize($path));
|
||||
header('Cache-Control: public,max-age=3600');
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ final class SettingsController
|
|||
http_response_code(404);
|
||||
return;
|
||||
}
|
||||
$mime = new finfo(FILEINFO_MIME_TYPE)->file($path) ?: 'application/octet-stream';
|
||||
$mime = (new finfo(FILEINFO_MIME_TYPE))->file($path) ?: 'application/octet-stream';
|
||||
header('Content-Type: ' . $mime);
|
||||
header('Content-Length: ' . filesize($path));
|
||||
header('Cache-Control: private, max-age=3600');
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ final class AgendaService
|
|||
? $end
|
||||
->modify(
|
||||
$start->getTimestamp() -
|
||||
new DateTimeImmutable($row['starts_at'])->getTimestamp() .
|
||||
(new DateTimeImmutable($row['starts_at']))->getTimestamp() .
|
||||
' seconds',
|
||||
)
|
||||
->format('Y-m-d H:i:s')
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ final class AssociationBrand
|
|||
throw new RuntimeException(t('service.logo.too_large'));
|
||||
}
|
||||
$tmp = (string) $upload['tmp_name'];
|
||||
$mime = new finfo(FILEINFO_MIME_TYPE)->file($tmp);
|
||||
$mime = (new finfo(FILEINFO_MIME_TYPE))->file($tmp);
|
||||
$extension = self::MIME_EXTENSIONS[$mime] ?? null;
|
||||
if (!$extension) {
|
||||
throw new RuntimeException(t('service.logo.format'));
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ final class BackupService
|
|||
if (!is_dir($backupDir) && !mkdir($backupDir, 0775, true) && !is_dir($backupDir)) {
|
||||
throw new RuntimeException(t('service.backup.directory_failed'));
|
||||
}
|
||||
$stamp = new DateTimeImmutable('now', new DateTimeZone('Europe/Paris'))->format('Ymd-His');
|
||||
$stamp = (new DateTimeImmutable('now', new DateTimeZone('Europe/Paris')))->format('Ymd-His');
|
||||
$suffix = $reason === 'pre-restore' ? '-avant-restauration' : '';
|
||||
$target = $backupDir . '/globinours-' . $stamp . $suffix . '.zip';
|
||||
// Certains volumes synchronisés acceptent les ZIP mais SQLite ne peut pas
|
||||
|
|
@ -50,7 +50,7 @@ final class BackupService
|
|||
$manifest = [
|
||||
'application' => 'Globinours',
|
||||
'format_version' => self::FORMAT_VERSION,
|
||||
'created_at' => new DateTimeImmutable('now', new DateTimeZone('Europe/Paris'))->format(
|
||||
'created_at' => (new DateTimeImmutable('now', new DateTimeZone('Europe/Paris')))->format(
|
||||
DateTimeInterface::ATOM,
|
||||
),
|
||||
'reason' => $reason,
|
||||
|
|
@ -434,7 +434,7 @@ final class BackupService
|
|||
|
||||
private static function describe(string $path): array
|
||||
{
|
||||
$modified = new DateTimeImmutable('@' . (filemtime($path) ?: time()))->setTimezone(
|
||||
$modified = (new DateTimeImmutable('@' . (filemtime($path) ?: time())))->setTimezone(
|
||||
new DateTimeZone('Europe/Paris'),
|
||||
);
|
||||
return ['name' => basename($path), 'size' => filesize($path) ?: 0, 'date' => $modified->format('d/m/Y H:i:s')];
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ final class PrivacyService
|
|||
'deposited_animals' =>
|
||||
'SELECT internal_code,name,intake_date,intake_type,intake_reason,intake_circumstances FROM animals WHERE depositor_contact_id=? ORDER BY intake_date',
|
||||
];
|
||||
$payload = ['generated_at' => new DateTimeImmutable()->format(DATE_ATOM), 'contact' => $contact];
|
||||
$payload = ['generated_at' => (new DateTimeImmutable())->format(DATE_ATOM), 'contact' => $contact];
|
||||
foreach ($queries as $key => $sql) {
|
||||
$q = $db->prepare($sql);
|
||||
$q->execute([$id]);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ final class PrivateMediaService
|
|||
http_response_code(404);
|
||||
return;
|
||||
}
|
||||
$mime = new finfo(FILEINFO_MIME_TYPE)->file($path) ?: 'application/octet-stream';
|
||||
$mime = (new finfo(FILEINFO_MIME_TYPE))->file($path) ?: 'application/octet-stream';
|
||||
PrivacyService::logAccess(
|
||||
'private_' . $kind,
|
||||
$id,
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ final class SystemHealthService
|
|||
return [
|
||||
'checks' => $checks,
|
||||
'summary' => $summary,
|
||||
'generated_at' => new DateTimeImmutable('now', new DateTimeZone('Europe/Paris'))->format('d/m/Y H:i:s'),
|
||||
'generated_at' => (new DateTimeImmutable('now', new DateTimeZone('Europe/Paris')))->format('d/m/Y H:i:s'),
|
||||
'php' => PHP_VERSION,
|
||||
'sqlite' => (string) $db->query('SELECT sqlite_version()')->fetchColumn(),
|
||||
];
|
||||
|
|
@ -181,7 +181,7 @@ final class SystemHealthService
|
|||
$lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [];
|
||||
$dates = [];
|
||||
for ($i = 0; $i < $days; $i++) {
|
||||
$dates[] = new DateTimeImmutable("-$i days")->format('d-M-Y');
|
||||
$dates[] = (new DateTimeImmutable("-$i days"))->format('d-M-Y');
|
||||
}
|
||||
$count = 0;
|
||||
foreach (array_slice($lines, -1000) as $line) {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ try {
|
|||
$outside = AgendaService::save([
|
||||
'item_type' => 'task',
|
||||
'title' => 'Semaine suivante',
|
||||
'date' => new DateTimeImmutable('monday next week')->format('Y-m-d'),
|
||||
'date' => (new DateTimeImmutable('monday next week'))->format('Y-m-d'),
|
||||
'time' => '10:00',
|
||||
]);
|
||||
$ids = array_map('intval', array_column(AgendaService::week(new DateTimeImmutable('today')), 'id'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue