Skip to content

Commit d1918aa

Browse files
committed
Fix nested non-sequential file arrays
1 parent 3f615c2 commit d1918aa

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/Drivers/LaravelHttpServer.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,15 @@ private function convertUploadedFiles(array $files): array
309309
{
310310
// @phpstan-ignore-next-line
311311
return array_map(function (array $file) {
312-
if (isset($file['error']) && $file['error'] === UPLOAD_ERR_NO_FILE) {
313-
return $file;
312+
if (isset($file['error'])) {
313+
if ($file['error'] === UPLOAD_ERR_NO_FILE) {
314+
return $file;
315+
}
316+
317+
return new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], true);
314318
}
315319

316-
return array_is_list($file)
317-
? $this->convertUploadedFiles($file)
318-
: new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error'], true);
320+
return $this->convertUploadedFiles($file);
319321
}, $files);
320322
}
321323

0 commit comments

Comments
 (0)