-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
| Q | A |
|---|---|
| Bug? | yes |
| New Feature? | no |
| Bundle Version | 2.5.4 |
| Sulu Version | 2.5.20 |
| Browser Version | n/a |
Actual Behavior
In
SuluFormBundle/Form/Handler.php
Line 257 in 12d2df1
| private function uploadMedia(FormInterface $form, FormConfigurationInterface $configuration): array |
The part
if (!\count($formField->getData())) {
continue;
}
leads to the error:
count(): Argument #1 ($value) must be of type Countable|array, Symfony\Component\HttpFoundation\File\UploadedFile given
Expected Behavior
I think the intention of the code a few lines later
if (!\is_array($files)) {
$files = [$files];
}
is to generate an array containing a single UploadedFile object. But that cannot be achieved because of the count before.
Steps to Reproduce
Using a custom file upload field type (by overwriting the AttachmentType throughservice decoration or compiler pass) without the multiple option.
Possible Solutions
if (!$formField->getData() instanceof UploadedFile && !\count($formField->getData())) {
continue;
}
Metadata
Metadata
Assignees
Labels
No labels