From e5ae2db4184c0250adfff384e0d7231ba9d75ca5 Mon Sep 17 00:00:00 2001 From: Avior Date: Fri, 26 Apr 2019 10:31:14 +0200 Subject: [PATCH] Fixed PHPMD global usage --- src/DeltaCMS/Form/ArrayInput.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DeltaCMS/Form/ArrayInput.php b/src/DeltaCMS/Form/ArrayInput.php index b37559f..1d2a38f 100644 --- a/src/DeltaCMS/Form/ArrayInput.php +++ b/src/DeltaCMS/Form/ArrayInput.php @@ -52,12 +52,13 @@ class ArrayInput extends AbstractInput public function getValue($name = null) { - if (!isset($_POST[$this->attributes["name"]]) || empty($_POST[$this->attributes["name"]])) { + $post = filter_input_array(INPUT_POST)[$this->attributes["name"]]; + if (!isset($post) || empty($post)) { return array(); } $clas = $this->options["array_type"]; $arr = array(); - foreach ($_POST[$this->attributes["name"]] as $name => $value) { + foreach (array_keys($post) as $name) { $input = new $clas(); $input->setOption("name", $this->attributes["name"]); $arr[] = $input->getValue($name);