Eigenreparatur phpMyAdmin in Debian Stretch

Vor einiger Zeit hatte ich hier im Blog ja einen Patch für phpMyAdmin unter Debian Jessie gepostet, der das Problem behebt, dass man die Eingabefelder für char– und varchar-Datenfelder nicht von <textarea> auf <input> umschalten kann. Kürzlich habe ich von Jessie auf Debian Stretch upgegradet und musste dabei feststellen, dass das Problem immer noch besteht. Also habe ich die Datei libraries/insert_edit.lib.php erneut gepatcht:

@@ -1195,11 +1195,19 @@
             . 'max="' . $min_max_values[1] . '"';
         $data_type = 'INT';
     }
+
+    if ($column['is_char']) {
+        $extracted_columnspec = PMA\libraries\Util::extractColumnSpec($column['Type']);
+        $maxlength = $extracted_columnspec['spec_in_brackets'];
+    } else {
+        $maxlength = $fieldsize;
+    }
+
     return '<input type="' . $input_type . '"'
         . ' name="fields' . $column_name_appendix . '"'
         . ' value="' . $special_chars . '" size="' . $fieldsize . '"'
         . ((isset($column['is_char']) && $column['is_char'])
-        ? ' data-maxlength="' . $fieldsize . '"'
+        ? ' data-maxlength="' . $maxlength . '"'
         : '')
         . ($readOnly ? ' readonly="readonly"' : '')
         . ($input_min_max !== false ? ' ' . $input_min_max : '')
@@ -1316,7 +1324,7 @@
     $fieldsize = PMA_getColumnSize($column, $extracted_columnspec);
     $html_output = $backup_field . "\n";
     if ($column['is_char']
-        && ($GLOBALS['cfg']['CharEditing'] == 'textarea'
+        && ($default_char_editing == 'textarea'
         || mb_strpos($data, "\n") !== false)
     ) {
         $html_output .= "\n";
@@ -1327,6 +1335,7 @@
             $special_chars_encoded, $data_type, $readOnly
         );
     } else {
+       $GLOBALS['cfg']['CharEditing'] = $default_char_editing;
         $html_output .= PMA_getHTMLinput(
             $column, $column_name_appendix, $special_chars, $fieldsize,
             $onChangeClause, $tabindex, $tabindex_for_value, $idindex,

Möge es helfen… 😉

Schreibe einen Kommentar