summaryrefslogtreecommitdiff
path: root/classes/pluginhost.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-08 12:10:25 +0300
committerAndrew Dolgov <[email protected]>2021-02-08 12:10:25 +0300
commit4165834f800dbcae058cd43f6dd627292558accf (patch)
treedd3acddd04eab3870e141dcedd753775bb5f8f86 /classes/pluginhost.php
parent9de26d44da61f15d1be8762416ddd1f36a1baaa2 (diff)
pluginhost: catch fatal errors in plugin init
Diffstat (limited to 'classes/pluginhost.php')
-rwxr-xr-xclasses/pluginhost.php40
1 files changed, 23 insertions, 17 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index bcde12551..5df58e5d5 100755
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -249,23 +249,29 @@ class PluginHost {
$this->last_registered = $class;
- switch ($kind) {
- case $this::KIND_SYSTEM:
- if ($this->is_system($plugin)) {
- if (!$skip_init) $plugin->init($this);
- $this->register_plugin($class, $plugin);
- }
- break;
- case $this::KIND_USER:
- if (!$this->is_system($plugin)) {
- if (!$skip_init) $plugin->init($this);
- $this->register_plugin($class, $plugin);
- }
- break;
- case $this::KIND_ALL:
- if (!$skip_init) $plugin->init($this);
- $this->register_plugin($class, $plugin);
- break;
+ try {
+ switch ($kind) {
+ case $this::KIND_SYSTEM:
+ if ($this->is_system($plugin)) {
+ if (!$skip_init) $plugin->init($this);
+ $this->register_plugin($class, $plugin);
+ }
+ break;
+ case $this::KIND_USER:
+ if (!$this->is_system($plugin)) {
+ if (!$skip_init) $plugin->init($this);
+ $this->register_plugin($class, $plugin);
+ }
+ break;
+ case $this::KIND_ALL:
+ if (!$skip_init) $plugin->init($this);
+ $this->register_plugin($class, $plugin);
+ break;
+ }
+ } catch (Exception $ex) {
+ user_error($ex, E_USER_WARNING);
+ } catch (Error $err) {
+ user_error($err, E_USER_WARNING);
}
}
}