From: Robin Appelman Date: Sun, 16 Dec 2012 19:29:36 +0000 (+0100) Subject: wrap hooks into a try, catch to prevent a faulty app from crashing the request X-Git-Tag: v5.0.0alpha1~318^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4301cd7f61f0cf07458f49430c098aac04882fbc;p=nextcloud-server.git wrap hooks into a try, catch to prevent a faulty app from crashing the request --- diff --git a/lib/hook.php b/lib/hook.php index 26a53693748..4da331bb5d8 100644 --- a/lib/hook.php +++ b/lib/hook.php @@ -59,7 +59,11 @@ class OC_Hook{ // Call all slots foreach( self::$registered[$signalclass][$signalname] as $i ) { - call_user_func( array( $i["class"], $i["name"] ), $params ); + try { + call_user_func( array( $i["class"], $i["name"] ), $params ); + } catch (Exception $e){ + OC_Log::write('hook', 'error while running hook (' . $i["class"] . '::' . $i["name"] . '): '.$e->getMessage(), OC_Log::ERROR); + } } // return true