From: Peter Knut Date: Wed, 9 Oct 2024 07:19:37 +0000 (+0200) Subject: Editor: Fix building links with array parameters X-Git-Tag: v4.16.0~77 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=4e825a36d3be95c50e73755871ef99999a9590a1;p=adminer.git Editor: Fix building links with array parameters This solves a situation when enum data type has a foreign key to another table. --- diff --git a/adminer/select.inc.php b/adminer/select.inc.php index d213ae96..91c83e1a 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -224,14 +224,16 @@ if (is_ajax()) { $set = null; if (isset($rights["insert"]) || !support("table")) { - $set = ""; + $params = []; foreach ((array) $_GET["where"] as $val) { - if ($foreign_keys[$val["col"]] && count($foreign_keys[$val["col"]]) == 1 && ($val["op"] == "=" - || (!$val["op"] && !preg_match('~[_%]~', $val["val"])) // LIKE in Editor + if (isset($foreign_keys[$val["col"]]) && count($foreign_keys[$val["col"]]) == 1 + && ($val["op"] == "=" || (!$val["op"] && (is_array($val["val"]) || !preg_match('~[_%]~', $val["val"]))) // LIKE in Editor )) { - $set .= "&set" . urlencode("[" . bracket_escape($val["col"]) . "]") . "=" . urlencode($val["val"]); + $params["set" . "[" . bracket_escape($val["col"]) . "]"] = $val["val"]; } } + + $set = $params ? "&" . http_build_query($params) : ""; } $adminer->selectLinks($table_status, $set); @@ -430,7 +432,7 @@ if (!$columns && support("table")) { $link .= where_link($i++, $k, $v); } } - + $val = select_value($val, $link, $field, $text_length); $id = h("val[$unique_idf][" . bracket_escape($key) . "]"); $value = $_POST["val"][$unique_idf][bracket_escape($key)]; @@ -491,7 +493,7 @@ if (!$columns && support("table")) { echo "\n"; } } - + echo "