Skip to content

Commit 1f9caf9

Browse files
dnmvissertvdijen
andcommitted
Use DateTime() instead of date() (#2084)
* Use DateTime() instead of date() * Use DateTimeImmutable instead --------- Co-authored-by: Tim van Dijen <tvdijen@gmail.com>
1 parent 7dd9352 commit 1f9caf9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/SimpleSAML/Logger/FileLoggingHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
namespace SimpleSAML\Logger;
66

7+
use DateTimeImmutable;
78
use SimpleSAML\{Configuration, Logger, Utils};
89
use Symfony\Component\Filesystem\Filesystem;
910
use Symfony\Component\HttpFoundation\File\Exception\CannotWriteFileException;
1011
use Symfony\Component\HttpFoundation\File\File;
1112

1213
use function array_key_exists;
13-
use function date;
1414
use function file_put_contents;
1515
use function preg_match;
1616
use function preg_replace;
@@ -132,7 +132,8 @@ public function log(int $level, string $string): void
132132
}
133133

134134
$formats[] = $matches[0];
135-
$replacements[] = date($format);
135+
$date = new DateTimeImmutable();
136+
$replacements[] = $date->format($format);
136137
}
137138

138139
if (preg_match('/^php:\/\//', $this->logFile)) {

0 commit comments

Comments
 (0)