When adding multiple images/files to multiple image fields on a single entity, most of these images are not persisted and are list.
This is due to the way the limit validation form api feature works. It only adds the validated items to $form_state['values'], something that was changed during the development of D7 and while the default multiple values field widget implementation was updated to fix this, the file/image widget was not and still assumes that all already uploaded files are present in $form_state['values'].
What exactly happens is that when uploading a new image, even though only the relevant part of the form is returned, the full form including all widgets are rebuilt from scratch and because the rebuilding code does not find the images, they are not correctly rebuilt.
This can also be seen when disabling ajax, since in that case, the whole form is rendered again and displayed and the already uploaded images are immediatly lost while when using ajax, this bug is only visible after saving the entity.
The patch re-implements the same workaround that the default multiple values field widget uses. It stores the form values separately in form_state and fetches them from there.
A better way would be if the field API would automatically handle this and provide all existing values in $items every time the form is built.. $Items is currently only used when editing an existing entity (it then contains the current values of that entities) and even then, only those who are actually persisted and updates aren't reflected. Although not many field implementations need to do it, but currently, writing a custom multiple values field widget is extremely hard due to issues like this.
However, something like that would be impossible to backport to D7, so this needs to be fixed first before a better way to deal with this can be found.
The patch attached inworks, has automated tests and has also been tested manually multiple times. The code needs to be reviewed so that it can be commited.
Original report by David D
I don't know if this should be listed under "file system" or "image system", but here's the problem:
The issue is that with an image field set to unlimited in a vertical tab (using field_group 7.x-1.0-rc1), multiple images may or may not get saved. By re-editing the node multiple times, all images can eventually get added, but in general only one additional image per field can be added per save. In case this is related to the contrib module, I've posted there as well. I've got a content type with a series of 6 field groups each having an unlimited image field, and the effect is happening on every image field.
PHP memory limit 128M
PASSED: [[SimpleTest]]: [MySQL] 33,072 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 33,748 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 29,894 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] 29,459 pass(es), 17 fail(s), and 0 exception(es). View