You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validation in file_field_widget_multiple_count_validate() does not work properly.
It should prevent too many field items, if a restriction via field cardinality exists on node (entity) save. It doesn't. Instead it causes a fatal error.
Same problem when selecting more than allowed from image library.
Steps To Reproduce
Attach an image field to a node
Set a limit on image count (field cardinality > 1, but < unlimited)
Open the node form and upload images, more than allowed
Alternative way to trigger:
Attach an image field to a node
Set a limit on image count (field cardinality > 1, but < unlimited)
Create a node with that amount of images (adhere max)
Go to admin/structure/types/manage/NODE_TYPE/fields/field_SOMETHING and lower the limit
Open that node form again and save without any changes
Another way to trigger:
Attach an image field to a node
Set a limit on image count (field cardinality > 1, but < unlimited), make sure the image browser's enabled
Open the node form
Open the image library dialog and add limit - 1 images
You can upload more images than field cardinality allows. They show up in the field list in that form.
Now try to save the node.
TypeError: array_slice(): Argument #1 ($array) must be of type array, string given in array_slice() (line 1049 of ...core/modules/file/file.field.inc).
Expected behavior
I shouldn't even have come to that point (too many images), but that's a topic on its own.
Saving the node should definitely not end up with a TypeError. 😬
Description of the bug
Validation in file_field_widget_multiple_count_validate() does not work properly.
It should prevent too many field items, if a restriction via field cardinality exists on node (entity) save. It doesn't. Instead it causes a fatal error.
Same problem when selecting more than allowed from image library.
Steps To Reproduce
Alternative way to trigger:
Another way to trigger:
limit - 1imagesActual behavior
You can upload more images than field cardinality allows. They show up in the field list in that form.
Now try to save the node.
Expected behavior
I shouldn't even have come to that point (too many images), but that's a topic on its own.
Saving the node should definitely not end up with a TypeError. 😬
Additional information
Initially it thought, it's related to the dimension limit, but the actual problem is how form_state values get handled.