Fix setting password if no encryption key exists
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 10 Sep 2010 21:22:47 +0000 (15:22 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 10 Sep 2010 22:51:43 +0000 (16:51 -0600)
framework/Imap_Client/lib/Horde/Imap/Client/Base.php

index 7a10b7f..bd1af07 100644 (file)
@@ -145,11 +145,14 @@ abstract class Horde_Imap_Client_Base implements Serializable
         $this->_params = $params;
 
         // Encrypt password.
-        if (!is_null($this->_params['encryptKey'])) {
-            $secret = new Horde_Secret();
-            $this->_params['password'] = $secret->write($this->_getEncryptKey(), $this->_params['password']);
-            $this->_params['_passencrypt'] = true;
-        }
+        try {
+            $encrypt_key = $this->_getEncryptKey();
+            if (strlen($encrypt_key)) {
+                $secret = new Horde_Secret();
+                $this->_params['password'] = $secret->write($encrypt_key, $this->_params['password']);
+                $this->_params['_passencrypt'] = true;
+            }
+        } catch (Horde_Imap_Client_Exception $e) {}
 
         $this->_init();
     }