From 6b76ce6f6285fd0b3565fc911f6469d21a132149 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 19 Jan 2021 15:03:18 +0100 Subject: [PATCH 1/2] curl usage: support HTTP/2 response code header --- application/helper/ApplicationUtils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/helper/ApplicationUtils.php b/application/helper/ApplicationUtils.php index a6c03aae..f79998b5 100644 --- a/application/helper/ApplicationUtils.php +++ b/application/helper/ApplicationUtils.php @@ -37,7 +37,7 @@ public static function getLatestGitVersionCode($url, $timeout = 2) { list($headers, $data) = get_http_response($url, $timeout); - if (strpos($headers[0], '200 OK') === false) { + if (preg_match('#HTTP/[\d\.]+ 200(?: OK)?#', $headers[0]) !== 1) { error_log('Failed to retrieve ' . $url); return false; } From dafd3f081ab581e074f3280d4323dc92cb33df46 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 19 Jan 2021 15:03:28 +0100 Subject: [PATCH 2/2] format_date: include timezone in IntlDateFormatter object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @see https://www.php.net/manual/en/intldateformatter.format.php > If a DateTime or an IntlCalendar object is passed, its timezone is not considered. The object will be formatted using the formaterʼs configured timezone. If one wants to use the timezone of the object to be formatted, IntlDateFormatter::setTimeZone() must be called before with the objectʼs timezone. --- application/Utils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/Utils.php b/application/Utils.php index 952378ab..c5cd884b 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -323,6 +323,7 @@ function format_date($date, $time = true, $intl = true) IntlDateFormatter::LONG, $time ? IntlDateFormatter::LONG : IntlDateFormatter::NONE ); + $formatter->setTimeZone($date->getTimezone()); return $formatter->format($date); }