From 008043aa25fcca6b12b1aaaf728b1c5bdf19ca20 Mon Sep 17 00:00:00 2001 From: daitingting Date: Thu, 7 Jul 2022 05:31:24 +0000 Subject: [PATCH] * Fix bug #24912. --- module/custom/control.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/custom/control.php b/module/custom/control.php index e057255657..4e216e33a8 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -125,7 +125,7 @@ class custom extends control foreach($postArray->data->keys as $key) { if($module == 'testtask' and $field == 'typeList' and empty($key)) continue; - if(in_array($key, $keys)) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->custom->notice->repeatKey, $key)));; + if($key && in_array($key, $keys)) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->custom->notice->repeatKey, $key)));; $keys[] = $key; } } @@ -243,9 +243,12 @@ class custom extends control } $this->custom->deleteItems("lang=$lang&module=$module§ion=$field&vision={$this->config->vision}"); - $data = fixer::input('post')->get(); + $data = fixer::input('post')->get(); + $emptyKey = false; foreach($data->keys as $index => $key) { + if(!$key && $emptyKey) continue; + //if(!$system and (!$value or !$key)) continue; //Fix bug #951. $value = $data->values[$index]; @@ -253,6 +256,8 @@ class custom extends control if($key and trim($value) === '') return $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->valueEmpty)); // Fix bug #23538. $this->custom->setItem("{$lang}.{$module}.{$field}.{$key}.{$system}", $value); + + if(!$key) $emptyKey = true; } } if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));