From 4301cd7f61f0cf07458f49430c098aac04882fbc Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Sun, 16 Dec 2012 20:29:36 +0100
Subject: [PATCH] wrap hooks into a try, catch to prevent a faulty app from
 crashing the request

---
 lib/hook.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/hook.php b/lib/hook.php
index 26a5369374..4da331bb5d 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
-- 
GitLab