Skip to content

Commit bfbe586

Browse files
committed
Fix nested non-sequential file arrays
1 parent a0d191d commit bfbe586

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Drivers/LaravelHttpServer.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,15 @@ private function convertUploadedFiles(array $files): array
325325
{
326326
// @phpstan-ignore-next-line
327327
return array_map(function (array $file) {
328-
if (isset($file['error']) && $file['error'] === UPLOAD_ERR_NO_FILE) {
329-
return $file;
328+
if (isset($file['error'])) {
329+
if ($file['error'] === UPLOAD_ERR_NO_FILE) {
330+
return $file;
331+
}
332+
333+
return new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], true);
330334
}
331335

332-
return array_is_list($file)
333-
? $this->convertUploadedFiles($file)
334-
: new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], true);
336+
return $this->convertUploadedFiles($file);
335337
}, $files);
336338
}
337339

0 commit comments

Comments
 (0)