From 07e5d6962fd6a851bece053558a2146c337e4f84 Mon Sep 17 00:00:00 2001 From: Thalia Date: Tue, 20 Aug 2019 15:32:47 +0100 Subject: [PATCH] Put block cookie expiry into UTC for comparison with current time Change-Id: Ia01a364a01ebacec8783ecdcfe4a129cfb746eb8 --- includes/block/BlockManager.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/block/BlockManager.php b/includes/block/BlockManager.php index b67703cab1..4a5df8eb2e 100644 --- a/includes/block/BlockManager.php +++ b/includes/block/BlockManager.php @@ -21,6 +21,7 @@ namespace MediaWiki\Block; use DateTime; +use DateTimeZone; use DeferredUpdates; use IP; use MediaWiki\Config\ServiceOptions; @@ -435,7 +436,11 @@ class BlockManager { } // Set the cookie. Reformat the MediaWiki datetime as a Unix timestamp for the cookie. - $expiryValue = DateTime::createFromFormat( 'YmdHis', $expiryTime )->format( 'U' ); + $expiryValue = DateTime::createFromFormat( + 'YmdHis', + $expiryTime, + new DateTimeZone( 'UTC' ) + )->format( 'U' ); $cookieOptions = [ 'httpOnly' => false ]; $cookieValue = $this->getCookieValue( $block ); $response->setCookie( 'BlockID', $cookieValue, $expiryValue, $cookieOptions ); -- 2.20.1