From 3004a7bad937af80664e51302654434a06c5ef9a Mon Sep 17 00:00:00 2001 From: Nils Haagen Date: Wed, 13 Dec 2023 11:08:10 +0100 Subject: [PATCH] Maps: 39144, check for input (#6783) --- Services/Form/classes/class.ilLocationInputGUI.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Services/Form/classes/class.ilLocationInputGUI.php b/Services/Form/classes/class.ilLocationInputGUI.php index df9e239d6d19..d1d0210296eb 100755 --- a/Services/Form/classes/class.ilLocationInputGUI.php +++ b/Services/Form/classes/class.ilLocationInputGUI.php @@ -1,7 +1,5 @@ lng; $val = $this->strArray($this->getPostVar()); - if ($this->getRequired() && - (trim($val["latitude"]) == "" || trim($val["longitude"]) == "")) { + if ($this->getRequired() && ( + !isset($val["latitude"]) || trim($val["latitude"]) == "" || + !isset($val["longitude"]) || trim($val["longitude"]) == "" + )) { $this->setAlert($lng->txt("msg_input_is_required")); return false; } @@ -113,8 +115,8 @@ public function getInput(): array { $val = $this->strArray($this->getPostVar()); return [ - "latitude" => (float) $val["latitude"], - "longitude" => (float) $val["longitude"], + "latitude" => (float) ($val["latitude"] ?? 0), + "longitude" => (float) ($val["longitude"] ?? 0), "zoom" => (int) ($val["zoom"] ?? 0), "address" => ($val["address"] ?? "") ];