From eac34f6b61806d63d696682e0f55d0b3c3656f1f Mon Sep 17 00:00:00 2001 From: Josaphat Imani Date: Fri, 21 Jun 2024 11:21:23 +0200 Subject: [PATCH] Fixed undefined variable when no IMAP auth --- modules/imap/handler_modules.php | 12 ++++++------ tests/phpunit/config.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/imap/handler_modules.php b/modules/imap/handler_modules.php index 5f8e0d301d..37bdfba981 100644 --- a/modules/imap/handler_modules.php +++ b/modules/imap/handler_modules.php @@ -1564,12 +1564,12 @@ public function process() { if (! empty($auth_server['sieve_config_host'])) { $imap_details['sieve_config_host'] = $auth_server['sieve_config_host']; } - } - if (!$default_server_id) { - Hm_IMAP_List::add($imap_details); - } else { - // Perhaps something as changed - Hm_IMAP_List::edit($default_server_id, $imap_details); + if (!$default_server_id) { + Hm_IMAP_List::add($imap_details); + } else { + // Perhaps something as changed + Hm_IMAP_List::edit($default_server_id, $imap_details); + } } } } diff --git a/tests/phpunit/config.php b/tests/phpunit/config.php index 8ef3d0de1f..550b6a0df6 100644 --- a/tests/phpunit/config.php +++ b/tests/phpunit/config.php @@ -41,7 +41,7 @@ public function test_filter_servers() { $this->assertEquals(array('imap_servers' => array(array())), $this->config->filter_servers()); $this->config->set('imap_servers', array(array('default' => 1, 'server' => 'localhost'))); - $this->assertEquals(array('imap_servers' => array(array('default' => 1, 'server' => 'localhost'))), $this->config->filter_servers()); + $this->assertEquals(array(), $this->config->filter_servers()); $this->config->set('imap_servers', array(array('pass' => 'foo', 'server' => 'localhost'))); $this->config->set('no_password_save_setting', true);