From 118269b607bd957fa27d0296823d7e435e6900b9 Mon Sep 17 00:00:00 2001
From: Virsacer <virsacer@online.de>
Date: Sat, 10 Dec 2022 21:02:49 +0100
Subject: [PATCH] PHP 8.1 compatibility (fixes multiple deprecation messages
 and broken images)

---
 wwwroot/inc/caching.php       | 6 +++---
 wwwroot/inc/functions.php     | 6 +++---
 wwwroot/inc/interface-lib.php | 4 ++--
 wwwroot/inc/popup.php         | 2 +-
 wwwroot/inc/solutions.php     | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

Index: wwwroot/inc/caching.php
--- wwwroot/inc/caching.php.orig
+++ wwwroot/inc/caching.php
@@ -67,7 +67,7 @@ function HTTPDateToUnixTime ($string)
 	$formats['asctime'] = '/^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{2}| \d{1}) (\d{2}):(\d{2}):(\d{2}) (\d{4})$/';
 
 	$matches = array();
-	if (preg_match ($formats['rfc1123'], $string, $matches))
+	if (preg_match ($formats['rfc1123'], $string ?? "", $matches))
 	{
 		$hours = $matches[5];
 		$minutes = $matches[6];
@@ -76,7 +76,7 @@ function HTTPDateToUnixTime ($string)
 		$day = $matches[2];
 		$year = $matches[4];
 	}
-	elseif (preg_match ($formats['rfc850'], $string, $matches))
+	elseif (preg_match ($formats['rfc850'], $string ?? "", $matches))
 	{
 		$hours = $matches[5];
 		$minutes = $matches[6];
@@ -85,7 +85,7 @@ function HTTPDateToUnixTime ($string)
 		$day = $matches[2];
 		$year = $matches[4];
 	}
-	elseif (preg_match ($formats['asctime'], $string, $matches))
+	elseif (preg_match ($formats['asctime'], $string ?? "", $matches))
 	{
 		$hours = $matches[4];
 		$minutes = $matches[5];
