From ff1878f6cf6b87ce2b5d552c58536e98fbe233b6 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 21 Jul 2014 15:25:48 +0000 Subject: [PATCH] Try to catch exceptions in sieve connection --- emailadmin/inc/class.emailadmin_imap.inc.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/emailadmin/inc/class.emailadmin_imap.inc.php b/emailadmin/inc/class.emailadmin_imap.inc.php index fa423a7203..bd11149fd1 100644 --- a/emailadmin/inc/class.emailadmin_imap.inc.php +++ b/emailadmin/inc/class.emailadmin_imap.inc.php @@ -1107,13 +1107,18 @@ class emailadmin_imap extends Horde_Imap_Client_Socket implements defaultimap case 'retrieveRules': case 'getVacation': case 'setVacation': - if (is_null($this->sieve)) - { - PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION); - $this->sieve = new emailadmin_sieve($this); - $this->error =& $this->sieve->error; + try { + if (is_null($this->sieve)) + { + PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION); + $this->sieve = new emailadmin_sieve($this); + $this->error =& $this->sieve->error; + } + $ret = call_user_func_array(array($this->sieve,$name),$params); + } + catch(Exception $e) { + throw new PEAR_Exception('Error in Sieve: '.$e->getMessage(), $e); } - $ret = call_user_func_array(array($this->sieve,$name),$params); //error_log(__CLASS__.'->'.$name.'('.array2string($params).') returns '.array2string($ret)); return $ret; }