From 160f873672b152a3abacde9baad2c778615c271f Mon Sep 17 00:00:00 2001 From: Jonathan Straub Date: Sun, 1 Nov 2020 16:43:32 +0100 Subject: [PATCH 1/2] Added check for NULL value in PHP internal error handling Signed-off-by: Jonathan Straub --- settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.php b/settings.php index c8cbe922..fb6f1a2f 100644 --- a/settings.php +++ b/settings.php @@ -14,7 +14,7 @@ $piholeFTLConf = piholeFTLConfig(); // Handling of PHP internal errors $last_error = error_get_last(); -if($last_error["type"] === E_WARNING || $last_error["type"] === E_ERROR) +if($last_error && ($last_error["type"] === E_WARNING || $last_error["type"] === E_ERROR)) { $error .= "There was a problem applying your settings.
Debugging information:
PHP error (".htmlspecialchars($last_error["type"])."): ".htmlspecialchars($last_error["message"])." in ".htmlspecialchars($last_error["file"]).":".htmlspecialchars($last_error["line"]); } From f5d8ca98435de1e608a482fade0ba4d1c132ff28 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 8 Nov 2020 17:57:12 +0000 Subject: [PATCH 2/2] Update settings.php Co-authored-by: DL6ER --- settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.php b/settings.php index fb6f1a2f..a17309e3 100644 --- a/settings.php +++ b/settings.php @@ -14,7 +14,7 @@ $piholeFTLConf = piholeFTLConfig(); // Handling of PHP internal errors $last_error = error_get_last(); -if($last_error && ($last_error["type"] === E_WARNING || $last_error["type"] === E_ERROR)) +if(isset($last_error) && ($last_error["type"] === E_WARNING || $last_error["type"] === E_ERROR)) { $error .= "There was a problem applying your settings.
Debugging information:
PHP error (".htmlspecialchars($last_error["type"])."): ".htmlspecialchars($last_error["message"])." in ".htmlspecialchars($last_error["file"]).":".htmlspecialchars($last_error["line"]); }