From 1c77febeb1e7d6dcb3078804ec05abb934440de5 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sun, 13 Feb 2022 00:42:49 +1300 Subject: [PATCH] gmstrftime is deprecated in PHP 8.1 Switch to using gmdate. One benefit is that gmdate doesn't respect the locale, so we don't need the logic to hardcode the month in English. --- inc/always.php.in | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/inc/always.php.in b/inc/always.php.in index 74a0d631..92e128f0 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -460,26 +460,8 @@ function DeconstructURL( $url ) { * @param string $isodate The date to convert */ function ISODateToHTTPDate( $isodate ) { - // It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info. - $month = gmstrftime('%m', strtotime($isodate)); - switch( intval($month) ) { - case 1: $month = 'Jan'; break; - case 2: $month = 'Feb'; break; - case 3: $month = 'Mar'; break; - case 4: $month = 'Apr'; break; - case 5: $month = 'May'; break; - case 6: $month = 'Jun'; break; - case 7: $month = 'Jul'; break; - case 8: $month = 'Aug'; break; - case 9: $month = 'Sep'; break; - case 10: $month = 'Oct'; break; - case 11: $month = 'Nov'; break; - case 12: $month = 'Dec'; break; - default: - throw new Exception('Invalid month '.$month); - } // Use strtotime since strptime is not available on Windows platform. - return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) ); + return( gmdate('D, d M Y H:i:s T', strtotime($isodate)) ); } /**