From a02a9c7ce333f2507f7a0caa7ede02637956b853 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Thu, 27 Oct 2022 15:00:46 +0200 Subject: [PATCH] fix(filefield): do not assume index of files whern adding, removing then adding again a file, indexes are somewhat consumed. Indes 0 will not exist in uploads list. --- inc/field/filefield.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/inc/field/filefield.class.php b/inc/field/filefield.class.php index c43cfdfe8..baf97923a 100644 --- a/inc/field/filefield.class.php +++ b/inc/field/filefield.class.php @@ -129,8 +129,7 @@ public function moveUploads() { return; } $answer_value = []; - $index = 0; - foreach ($this->uploads["_$key"] as $document) { + foreach ($this->uploads["_$key"] as $index => $document) { $document = Toolbox::stripslashes_deep($document); if (is_file(GLPI_TMP_DIR . '/' . $document)) { $prefix = $this->uploads['_prefix_formcreator_field_' . $this->question->getID()][$index];