Skip to content

Commit 9f1a79c

Browse files
authored
[BUGFIX] Always use UTC as token creation date time zone (#234)
The creation date is saved in the database as a UNIX timestamp and thus does not contain a time zone. This causes the timestamp to result in different dates depending on the time zone set in the PHP configuration, leading to test failures on some systems. Now the timestamp will always be interpreted to be in the UTC timezone.
1 parent 4bbe783 commit 9f1a79c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Classes/Domain/Model/Identity/AdministratorToken.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function getCreationDate()
8080

8181
$date = new \DateTime();
8282
$date->setTimestamp($this->creationDate);
83+
$date->setTimezone(new \DateTimeZone('UTC'));
8384
return $date;
8485
}
8586

Tests/Integration/Domain/Repository/Identity/AdministratorTokenRepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function findReadsModelFromDatabase()
5151
$this->applyDatabaseChanges();
5252

5353
$id = 1;
54-
$creationDate = new \DateTime('2017-12-06 17:41:40');
54+
$creationDate = new \DateTime('2017-12-06 17:41:40+0000');
5555
$expiry = new \DateTime('2017-06-22 16:43:29');
5656
$key = 'cfdf64eecbbf336628b0f3071adba762';
5757

0 commit comments

Comments
 (0)