From 8646a87712cc4c451cca97947f0b803aa98509e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Barou=C5=A1?= Date: Fri, 1 Dec 2023 11:17:02 +0100 Subject: [PATCH] Fixes plugin edit-foreign.php When a table has a FK multiple times on a single table and the limit is exceeded, the select will no longer show for every field but the first for that target table. This made it impossible to save such tables correctly. --- plugins/edit-foreign.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/edit-foreign.php b/plugins/edit-foreign.php index ea205306..463eaae3 100644 --- a/plugins/edit-foreign.php +++ b/plugins/edit-foreign.php @@ -25,13 +25,17 @@ class AdminerEditForeign { $target = $foreignKey["table"]; $id = $foreignKey["target"][0]; $options = &$values[$target][$id]; - if (!$options) { + if ($options === false) { + return; + } + if (!isset($options)) { $column = idf_escape($id); if (preg_match('~binary~', $field["type"])) { $column = "HEX($column)"; } $options = array("" => "") + get_vals("SELECT $column FROM " . table($target) . " ORDER BY 1" . ($this->_limit ? " LIMIT " . ($this->_limit + 1) : "")); if ($this->_limit && count($options) - 1 > $this->_limit) { + $options = false; return; } }