From: Thalia Date: Tue, 20 Aug 2019 14:32:47 +0000 (+0100) Subject: Put block cookie expiry into UTC for comparison with current time X-Git-Tag: 1.34.0-rc.0~659^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/%7B%24conf-%3EScriptPath%7D/index.php?a=commitdiff_plain;h=07e5d6962fd6a851bece053558a2146c337e4f84;p=lhc%2Fweb%2Fwiklou.git Put block cookie expiry into UTC for comparison with current time Change-Id: Ia01a364a01ebacec8783ecdcfe4a129cfb746eb8 --- 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 );