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

Notices: Avoid accessing offset on null

Thanks to @peterpp at 62017e3.
This commit is contained in:
Jakub Vrana
2025-03-26 04:16:17 +01:00
parent d3be21e000
commit 1b8a428d2f
16 changed files with 37 additions and 27 deletions

View File

@@ -352,7 +352,7 @@ function process_input($field) {
return null;
}
$idf = bracket_escape($field["field"]);
$function = $_POST["function"][$idf];
$function = idx($_POST["function"], $idf);
$value = $_POST["fields"][$idf];
if ($field["type"] == "enum" || $driver->enumLength($field)) {
if ($value == -1) {
@@ -453,7 +453,7 @@ function edit_form($table, $fields, $row, $update) {
$autofocus = !$_POST;
foreach ($fields as $name => $field) {
echo "<tr><th>" . $adminer->fieldName($field);
$default = $_GET["set"][bracket_escape($name)];
$default = idx($_GET["set"], bracket_escape($name));
if ($default === null) {
$default = $field["default"];
if ($field["type"] == "bit" && preg_match("~^b'([01]*)'\$~", $default, $regs)) {
@@ -477,7 +477,7 @@ function edit_form($table, $fields, $row, $update) {
$value = $adminer->editVal($value, $field);
}
$function = ($_POST["save"]
? (string) $_POST["function"][$name]
? idx($_POST["function"], $name, "")
: ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field["on_update"])
? "now"
: ($value === false ? null : ($value !== null ? '' : 'NULL'))