From 2083c2b2261dddb52e5e1f18dcc75f79f33ab9ff Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Mon, 15 Dec 2003 21:40:22 +0000 Subject: [PATCH] safer array-index checks --- ChangeLog | 3 +++ tbl_replace.php | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6f7ff28c..cdc23efe0 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2003-12-15 Garvin Hicking + * tbl_replace.php: Check all required array indizes for multi-row edit + 2003-12-15 Marc Delisle * read_dump.php: bug 859062: Go & Bookmark problem when the query has a character like "+" in it diff --git a/tbl_replace.php b/tbl_replace.php index e7e126811..344401f39 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -86,11 +86,11 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { $valuelist = ''; // Map multi-edit keys to single-level arrays, dependent on how we got the fields - $me_fields = (isset($fields['multi_edit']) ? $fields['multi_edit'][$enc_primary_key] : (isset($fields) ? $fields : null)); - $me_fields_prev = (isset($fields_prev['multi_edit']) ? $fields_prev['multi_edit'][$enc_primary_key] : (isset($fields_prev) ? $fields_prev : null)); - $me_funcs = (isset($funcs['multi_edit']) ? $funcs['multi_edit'][$enc_primary_key] : (isset($funcs) ? $funcs : null)); - $me_fields_type = (isset($fields_type['multi_edit']) ? $fields_type['multi_edit'][$enc_primary_key] : (isset($fields_type) ? $fields_type : null)); - $me_fields_null = (isset($fields_null['multi_edit']) ? $fields_null['multi_edit'][$enc_primary_key] : (isset($fields_null) ? $fields_null : null)); + $me_fields = (isset($fields['multi_edit']) && isset($fields['multi_edit'][$enc_primary_key]) ? $fields['multi_edit'][$enc_primary_key] : (isset($fields) ? $fields : null)); + $me_fields_prev = (isset($fields_prev['multi_edit']) && isset($fields_prev['multi_edit'][$enc_primary_key]) ? $fields_prev['multi_edit'][$enc_primary_key] : (isset($fields_prev) ? $fields_prev : null)); + $me_funcs = (isset($funcs['multi_edit']) && isset($funcs['multi_edit'][$enc_primary_key]) ? $funcs['multi_edit'][$enc_primary_key] : (isset($funcs) ? $funcs : null)); + $me_fields_type = (isset($fields_type['multi_edit']) && isset($fields_type['multi_edit'][$enc_primary_key]) ? $fields_type['multi_edit'][$enc_primary_key] : (isset($fields_type) ? $fields_type : null)); + $me_fields_null = (isset($fields_null['multi_edit']) && isset($fields_null['multi_edit'][$enc_primary_key]) ? $fields_null['multi_edit'][$enc_primary_key] : (isset($fields_null) ? $fields_null : null)); foreach($me_fields AS $key => $val) { $encoded_key = $key; @@ -156,11 +156,11 @@ else { $fieldlist = ''; $valuelist = ''; - $me_fields = (isset($fields['multi_edit']) ? $fields['multi_edit'][$enc_primary_key] : (isset($fields) ? $fields : null)); - $me_fields_prev = (isset($fields_prev['multi_edit']) ? $fields_prev['multi_edit'][$enc_primary_key] : (isset($fields_prev) ? $fields_prev : null)); - $me_funcs = (isset($funcs['multi_edit']) ? $funcs['multi_edit'][$enc_primary_key] : (isset($funcs) ? $funcs : null)); - $me_fields_type = (isset($fields_type['multi_edit']) ? $fields_type['multi_edit'][$enc_primary_key] : (isset($fields_type) ? $fields_type : null)); - $me_fields_null = (isset($fields_null['multi_edit']) ? $fields_null['multi_edit'][$enc_primary_key] : (isset($fields_null) ? $fields_null : null)); + $me_fields = (isset($fields['multi_edit']) && isset($fields['multi_edit'][$enc_primary_key]) ? $fields['multi_edit'][$enc_primary_key] : (isset($fields) ? $fields : null)); + $me_fields_prev = (isset($fields_prev['multi_edit']) && isset($fields_prev['multi_edit'][$enc_primary_key]) ? $fields_prev['multi_edit'][$enc_primary_key] : (isset($fields_prev) ? $fields_prev : null)); + $me_funcs = (isset($funcs['multi_edit']) && isset($funcs['multi_edit'][$enc_primary_key]) ? $funcs['multi_edit'][$enc_primary_key] : (isset($funcs) ? $funcs : null)); + $me_fields_type = (isset($fields_type['multi_edit']) && isset($fields_type['multi_edit'][$enc_primary_key]) ? $fields_type['multi_edit'][$enc_primary_key] : (isset($fields_type) ? $fields_type : null)); + $me_fields_null = (isset($fields_null['multi_edit']) && isset($fields_null['multi_edit'][$enc_primary_key]) ? $fields_null['multi_edit'][$enc_primary_key] : (isset($fields_null) ? $fields_null : null)); // garvin: Get, if sent, any protected fields to insert them here: if (isset($me_fields_type) && is_array($me_fields_type) && isset($enc_primary_key)) {