Yeah, it's a little hard to summarize. Basically, I've got both imagefield and audiofield turned on. audiofield is storing audio information via filefield_meta. Imagefield is storing alt text (and other fields) via the serialized field_image_data column.

When the field goes through filefield_field_sanitize, it gets sent through field_file_load, which in turn calls filefield_meta_file_load - which returns a field with a 'data' element that is already an array. When, later on, the filefield_field_sanitize tries to check and see if $items[$delta]['data'] needs to be unserialized, it doesn't, because the serialized array that was there at the beginning of the loop has been replaced by the array from filefield_meta_file_load - and so you lose the data. My change checks to see if the old 'data' information is still there from the $item variable, unserializes it, and adds it to the data from filefield_meta. I don't have a patch on hand yet, as I'm still mucking about and removing my debug calls from checking to see where the data was disappearing!

Patch soon.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcfiala’s picture

Status: Active » Patch (to be ported)
FileSize
1.1 KB

Here's that patch I offered earlier.

quicksketch’s picture

Status: Patch (to be ported) » Needs review

Thanks jcfiala, that helps with multiple reported issues.

wayfarer_boy’s picture

Tried patch, but descriptions still weren't saved. Tried on fresh installs of 6.x-3.5 and 6.x-3.x-dev as didn't know which version to apply the patch to (but now on studying the patch, do I need to download HEAD from cvs?) Sorry, I'm still a bit naive when it comes to bug reports and reviewing.

jcfiala’s picture

Yeah - 6.x-3.x branch is actually filefield-HEAD, not filefield-6--3. That was confusing for me too.

wayfarer_boy’s picture

OK, replaced FileField with HEAD version and patched accordingly, but problem still remains. Here's the details:

Drupal 6.17
CCK 6.x-3.x-dev
ImageField 6.x-3.3
Filefield (Filefield-Meta enabled) HEAD

Tried to add a description to an imagefield field but upon saving changes, description not saved (unlimited values, no list option, description option on).

yan’s picture

Status: Needs review » Needs work

I came here from #831402: Values for ALT and TITLE are deleted when clicked on "Add another item".

My problem is similar. With Filefield Meta enabled, when I add an image and enter ALT text or other fields and then click on "Add another item", the text I entered is deleted after a new input field has been added.

The patch from #1 doesn't solve the problem for me.

jcfiala’s picture

Assigned: Unassigned » jcfiala

I've found a problem with filefield_widget_value in filefield_widget.inc that's similar, and so I'll be re-rolling this patch.

jcfiala’s picture

Status: Needs work » Needs review
FileSize
1.71 KB

Okay, patch revised!

yan’s picture

#8 solves my problem. Thanks a lot!

yan’s picture

But now I get this error:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /sites/all/modules/filefield/filefield_widget.inc on line 239.
PaulMagrath’s picture

Patch worked for me. Haven't seen that error you reported yet.

jcfiala’s picture

Status: Needs review » Needs work

@10: I ran into that same problem, actually, and just haven't had the time to re-roll my patch to solve that problem.

harcher’s picture

subscribe

Scott M. Sanders’s picture

Subscribe

riisi’s picture

subscribe

yan’s picture

Priority: Normal » Critical

I noticed it's even worse than I thought (see #6). The information is not only lost when clicking on "Add another item" but also when I edit a node, i.e. when I open node/*/edit, the title and alt fields are empty. This also happens with the patch from #8.

I think this is critical, because it can cause the loss of data.

harcher’s picture

Defenitly critical. This version should revert to dev since it will cause people to delete data after updating filefield module. I'm going back to 3.3.

quicksketch’s picture

Status: Needs work » Fixed
FileSize
17.8 KB

Okay here's a rather larger patch that corrects this problem. Most of the size is due to changes in the tests, which now enter in a "description" for files and enables filefield_meta for the duration of the tests. In the 3.5 version, all the tests pass fine unless you have FileField Meta, then things go pretty badly after enabling it during the test.

These test changes should prevent similar problems like this from occurring in the future. I've committed this patch to CVS, please either try it out on the 3.5 version or download the development version (after it's been repackaged tonight) to test it. I'll get a 3.6 version out once I get confirmation this fixes the problem for everyone.

harcher’s picture

Thanks quicksketch.

But I'm confused when you say "In the 3.5 version, all the tests pass fine unless you have FileField Meta, then things go pretty badly after enabling it during the test."

So can I use filefield 3.5, apply the patch #18 and enable filefield_meta? Will this fix the problem of 'description' field not getting saved?

quicksketch’s picture

Our tests didn't use to include filefield_meta while they ran. After I tried including filefield_meta in the test, they blew up horribly (since as many users have noted, filefield_meta breaks their site).

Bottom line, yes you can apply the patch in #18 to the 3.5 version and it fixes the problems described in this issue.

harcher’s picture

Makes sence. Will try and report back. Thanks again :)

harcher’s picture

Applied patch in #18 to 3.5.

I'm getting:
warning: array_merge() [function.array-merge]: Argument #1 is not an array in W:\projects_hamad\karmarama\httpdocs\modules\acquia\filefield\filefield_field.inc on line 291

This is on a view page that lists the files.

Status: Fixed » Closed (fixed)

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