Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bc804e

Browse files
committed
[FrameworkBundle][HttpKernel] fixed something
* Added a hardcoded day 01 in order to output the proper month November which is the correct EOL and EOM month. * \DateTime::createFromFormat('mY') will output December for every month where day 31 exists.
1 parent ba6dd85 commit 5bc804e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private static function formatFileSize(string $path): string
125125

126126
private static function isExpired(string $date): bool
127127
{
128-
$date = \DateTime::createFromFormat('m/Y', $date);
128+
$date = \DateTime::createFromFormat('d/m/Y', '01/'.$date);
129129

130130
return false !== $date && new \DateTime() > $date->modify('last day of this month 23:59:59');
131131
}

src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public function collect(Request $request, Response $response, \Exception $except
7171
$this->data['symfony_state'] = $this->determineSymfonyState();
7272
$this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION);
7373
$this->data['symfony_lts'] = 4 === Kernel::MINOR_VERSION;
74-
$eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE);
75-
$eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE);
74+
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
75+
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
7676
$this->data['symfony_eom'] = $eom->format('F Y');
7777
$this->data['symfony_eol'] = $eol->format('F Y');
7878
}
@@ -292,8 +292,8 @@ public function getName()
292292
private function determineSymfonyState(): string
293293
{
294294
$now = new \DateTime();
295-
$eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
296-
$eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month');
295+
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
296+
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE)->modify('last day of this month');
297297

298298
if ($now > $eol) {
299299
$versionState = 'eol';

0 commit comments

Comments
 (0)