From efaadf54d3471da11a31fcc2bc1edf05730f1d2d Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 16 Feb 2021 09:21:55 +0000 Subject: make sure we do not try to update columns which do not exist --- include/items.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 223fba147..12b543697 100644 --- a/include/items.php +++ b/include/items.php @@ -2392,9 +2392,14 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) { logger('item_store_update: ' . print_r($arr,true), LOGGER_DATA); - $str = ''; - foreach($arr as $k => $v) { - if($str) + $columns = db_columns('item'); + $str = ''; + foreach ($arr as $k => $v) { + if (!in_array($k, $columns)) { + continue; + } + + if ($str) $str .= ","; $str .= " " . TQUOT . $k . TQUOT . " = '" . $v . "' "; } -- cgit v1.2.3