From fdb4229644d9feecffc3a3d9cad45c1112ad7b0f Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 18 May 2005 11:16:10 +0000 Subject: [PATCH] Force hiding of error messages when the imap server is not available git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@239 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_mail-methods-cyrus.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/class_mail-methods-cyrus.inc b/include/class_mail-methods-cyrus.inc index 239cd2e8a..b49720074 100644 --- a/include/class_mail-methods-cyrus.inc +++ b/include/class_mail-methods-cyrus.inc @@ -18,6 +18,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +function fake_handler($log_level, $log_text, $error_file, $error_line) +{ +} class mailMethodCyrus extends mailMethod { @@ -33,11 +36,13 @@ class mailMethodCyrus extends mailMethod function connect($gosaMailServer) { /* Connect to IMAP server. I don't want to see these warning here... */ - error_reporting (0); $this->gosaMailServer= $gosaMailServer; $cfg= $this->config[$gosaMailServer]; + + /* For some reason, hiding errors with @ does not wor here... */ + $tmp= set_error_handler('fake_handler'); $this->mbox = @imap_open($cfg['connect'], $cfg['admin'], $cfg['password'], OP_HALFOPEN); - error_reporting (E_ALL); + set_error_handler($tmp); /* Mailbox reachable? */ if ($this->mbox === FALSE){ -- 2.30.2