diff --git a/src/Core/CHANGELOG.md b/src/Core/CHANGELOG.md index d46df2954..8dddfb3d1 100644 --- a/src/Core/CHANGELOG.md +++ b/src/Core/CHANGELOG.md @@ -19,6 +19,7 @@ ### Fixed - Buffer the response in temporary file to avoid issues when stream is used by another request's body +- SignerV4: Fix signing request during DST change ## 1.27.1 diff --git a/src/Core/src/Signer/SignerV4.php b/src/Core/src/Signer/SignerV4.php index 2d371de2a..b82d37d4d 100644 --- a/src/Core/src/Signer/SignerV4.php +++ b/src/Core/src/Signer/SignerV4.php @@ -62,7 +62,7 @@ public function __construct(string $scopeName, string $region) public function presign(Request $request, Credentials $credentials, RequestContext $context): void { - $now = $context->getCurrentDate() ?? new \DateTimeImmutable(); + $now = $context->getCurrentDate() ?? new \DateTimeImmutable('now', new \DateTimeZone('UTC')); // Signer date have to be UTC https://docs.aws.amazon.com/general/latest/gr/sigv4-date-handling.html $now = $now->setTimezone(new \DateTimeZone('UTC')); @@ -73,7 +73,7 @@ public function presign(Request $request, Credentials $credentials, RequestConte public function sign(Request $request, Credentials $credentials, RequestContext $context): void { - $now = $context->getCurrentDate() ?? new \DateTimeImmutable(); + $now = $context->getCurrentDate() ?? new \DateTimeImmutable('now', new \DateTimeZone('UTC')); // Signer date have to be UTC https://docs.aws.amazon.com/general/latest/gr/sigv4-date-handling.html $now = $now->setTimezone(new \DateTimeZone('UTC'));