Skip to content

Commit a02a9c7

Browse files
committed
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.
1 parent 8792ed3 commit a02a9c7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

inc/field/filefield.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ public function moveUploads() {
129129
return;
130130
}
131131
$answer_value = [];
132-
$index = 0;
133-
foreach ($this->uploads["_$key"] as $document) {
132+
foreach ($this->uploads["_$key"] as $index => $document) {
134133
$document = Toolbox::stripslashes_deep($document);
135134
if (is_file(GLPI_TMP_DIR . '/' . $document)) {
136135
$prefix = $this->uploads['_prefix_formcreator_field_' . $this->question->getID()][$index];

0 commit comments

Comments
 (0)