From 20b56b5b237a68d69218fea7fd9a8d1a4d1f2a0f Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <noreply@fakecake.org>
Date: Mon, 8 Feb 2021 12:14:12 +0300
Subject: [PATCH] pluginhost: catch errors while loading plugin source code

---
 classes/pluginhost.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 5df58e5d5..413fddeae 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -210,7 +210,12 @@ class PluginHost {
 			}
 
 			if (!isset($this->plugins[$class])) {
-				if (file_exists($file)) require_once $file;
+				try {
+					if (file_exists($file)) require_once $file;
+				} catch (Error $err) {
+					user_error($err, E_USER_WARNING);
+					continue;
+				}
 
 				if (class_exists($class) && is_subclass_of($class, "Plugin")) {
 
-- 
GitLab