diff options
author | Aleksander Machniak <alec@alec.pl> | 2022-11-13 15:19:45 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2022-11-13 15:19:45 +0300 |
commit | e6ed5ae19e3071d4d3203a38b57167fb83ce0051 (patch) | |
tree | 5b78af0d4239c3afa1042d220ea777de590a239a | |
parent | c78d998ec335ba3644ca3055c7cb37a32d4fddfa (diff) |
Fix handling of smtp/imap port options on configuration file update (#8756)
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | program/include/rcmail_install.php | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a759a6e1..83732d1eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Fix fatal error on identity page if Enigma plugin is misconfigured (#8719) - Fix so N property always exists in a vCard export (#8771) - Fix authenticating to Courier IMAP with passwords containing a '~' character (#8772) +- Fix handling of smtp/imap port options on configuration file update (#8756) ## Release 1.6.0 diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php index eb922e0f5..c91a61514 100644 --- a/program/include/rcmail_install.php +++ b/program/include/rcmail_install.php @@ -434,6 +434,20 @@ class rcmail_install unset($current[$replacement]); } + // Merge old *_port options into the new *_host options, where possible + foreach (['default' => 'imap', 'smtp' => 'smtp'] as $prop => $type) { + $old_prop = "{$prop}_port"; + $new_prop = "{$type}_host"; + if (!empty($current[$old_prop]) && !empty($this->config[$new_prop]) + && is_string($this->config[$new_prop]) + && !preg_match('/:[0-9]+$/', $this->config[$new_prop]) + ) { + $this->config[$new_prop] .= ':' . $current[$old_prop]; + } + + unset($current[$old_prop]); + } + foreach ($this->obsolete_config as $prop) { unset($current[$prop]); } |