Hello

I've spoted this tricky bug while using image_field, but I think that this bug caused by filefield.

Steps to reproduce:
1. Create the multi-valued field for your content type
2. Go to node creation form
- upload 1-st item
- upload 2-nd item
- press "Add another item" and upload 3-rd item
3. Submit this form

You'll see such order in your field:
1. Your 1st item
2. Your 3rd item
3. Your 2nd item

It's because your 3rd item didn't get the correct _weigth while form submit (and gets zero by deffault). I've traced it in filefield_js() function using watchdog before form_set_cache(). While 1st and 2nd items there has correct _weight param (it seens like for item - an array with #such keys), the 3rd equels simple integer there (sorry for my lame explanation).

I spent 5 hours debugging the CCK and filefield (and almost broke my mind :), but didn't succeed in catching the actual reason of this bug. Hope you'll help.

CommentFileSizeAuthor
#5 filefield.module_.patch444 bytesneochief
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neochief’s picture

(it seems like form item - an array with #such keys) *

drewish’s picture

Priority: Critical » Normal
dopry’s picture

Status: Active » Postponed (maintainer needs more info)

This seems like an upstream issue at first glance... Those weights come from CCK... is this issue exclusively for filefield or does it also affect other field types?

neochief’s picture

It happens only with file-field widget. This weekend I'll try to finally catch this bug.

neochief’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
444 bytes

Finally, I found that this bug is dissapearing when you removing form_set_cache() from the deep of filefield_js() function. It seems that this functions overwrites correct form with some incorrect data and bug is occuring. Anyway, with removing this, nothing seems to be broken and filefield works as ususal.

Here's the patch:

dopry’s picture

Status: Needs review » Fixed

Doesn't seem to break anything, drops a line of code... :) committed to head.. tell me if it's better.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.