From 613ccd7e05143eb736217b485bee8756010d6818 Mon Sep 17 00:00:00 2001 From: Vitaly Lavrov Date: Sun, 24 Nov 2024 16:18:06 +0300 Subject: [PATCH] BUG: get_variable for postgres never returns a value (#9710) Because of this, the insert_or_update() method never uses the "INSERT INTO ... ON CONFLICT DO UPDATE SET ..." command, and the logs constantly show errors adding records to the message cache due to "duplicate key". --- program/lib/Roundcube/db/pgsql.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/program/lib/Roundcube/db/pgsql.php b/program/lib/Roundcube/db/pgsql.php index 13f5724437a..9195998f1a6 100644 --- a/program/lib/Roundcube/db/pgsql.php +++ b/program/lib/Roundcube/db/pgsql.php @@ -173,7 +173,10 @@ public function get_variable($varname, $default = null) return rcube::get_instance()->config->get('db_' . $varname, $default); } - $this->variables[$varname] = rcube::get_instance()->config->get('db_' . $varname); + $cfgval = rcube::get_instance()->config->get('db_' . $varname); + if (isset($cfgval)) { + return $cfgval; + } if (!isset($this->variables)) { $this->variables = [];