AdminerEnumOption: Fix after bug #1152 (fix #1191)

This commit is contained in:
Jakub Vrana
2025-10-27 15:34:01 +01:00
parent 240c8fc5e7
commit e6be47941b

View File

@@ -11,23 +11,23 @@ class AdminerEnumOption extends Adminer\Plugin {
function editInput($table, $field, $attrs, $value) {
if ($field["type"] == "enum") {
$options = array();
$selected = $value;
$selected = "val-$value";
if (isset($_GET["select"])) {
$options[-1] = Adminer\lang('original');
if ($selected === null) {
$selected = -1;
$options["orig"] = Adminer\lang('original');
if ($value === null) {
$selected = "orig";
}
}
if ($field["null"]) {
$options[""] = "NULL";
if ($selected === null) {
$selected = "";
$options["null"] = "NULL";
if ($value === null) {
$selected = "null";
}
}
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $val) {
$val = stripcslashes(str_replace("''", "'", $val));
$options[$val] = $val;
$options["val-$val"] = $val;
}
return "<select$attrs>" . Adminer\optionlist($options, $selected, 1) . "</select>"; // 1 - use keys
}