1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 15:47:00 +02:00

MySQL: Stop treating enum as set as numbers (bug #475)

This commit is contained in:
Jakub Vrana
2025-03-10 23:32:28 +01:00
parent 6fdde32f86
commit 37e63dd82f
5 changed files with 17 additions and 32 deletions

View File

@@ -20,20 +20,16 @@ class AdminerEnumOption {
}
if ($field["null"]) {
$options[""] = "NULL";
if ($value === null && !isset($_GET["select"])) {
if ($selected === null) {
$selected = "";
}
}
$options[0] = Adminer\lang('empty');
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) {
foreach ($matches[1] as $val) {
$val = stripcslashes(str_replace("''", "'", $val));
$options[$i + 1] = $val;
if ($value === $val) {
$selected = $i + 1;
}
$options[$val] = $val;
}
return "<select$attrs>" . Adminer\optionlist($options, (string) $selected, 1) . "</select>"; // 1 - use keys
return "<select$attrs>" . Adminer\optionlist($options, $selected, 1) . "</select>"; // 1 - use keys
}
}
}