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.
Comment | File | Size | Author |
---|---|---|---|
#18 | filefield_data_loading.patch | 17.8 KB | quicksketch |
#8 | filefield-834018.patch | 1.71 KB | jcfiala |
#1 | filefield-834018.patch | 1.1 KB | jcfiala |
Comments
Comment #1
jcfiala CreditAttribution: jcfiala commentedHere's that patch I offered earlier.
Comment #2
quicksketchThanks jcfiala, that helps with multiple reported issues.
Comment #3
wayfarer_boy CreditAttribution: wayfarer_boy commentedTried 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.
Comment #4
jcfiala CreditAttribution: jcfiala commentedYeah - 6.x-3.x branch is actually filefield-HEAD, not filefield-6--3. That was confusing for me too.
Comment #5
wayfarer_boy CreditAttribution: wayfarer_boy commentedOK, 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).
Comment #6
yan CreditAttribution: yan commentedI 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.
Comment #7
jcfiala CreditAttribution: jcfiala commentedI've found a problem with filefield_widget_value in filefield_widget.inc that's similar, and so I'll be re-rolling this patch.
Comment #8
jcfiala CreditAttribution: jcfiala commentedOkay, patch revised!
Comment #9
yan CreditAttribution: yan commented#8 solves my problem. Thanks a lot!
Comment #10
yan CreditAttribution: yan commentedBut now I get this error:
Comment #11
PaulMagrath CreditAttribution: PaulMagrath commentedPatch worked for me. Haven't seen that error you reported yet.
Comment #12
jcfiala CreditAttribution: jcfiala commented@10: I ran into that same problem, actually, and just haven't had the time to re-roll my patch to solve that problem.
Comment #13
harcher CreditAttribution: harcher commentedsubscribe
Comment #14
Scott M. Sanders CreditAttribution: Scott M. Sanders commentedSubscribe
Comment #15
riisi CreditAttribution: riisi commentedsubscribe
Comment #16
yan CreditAttribution: yan commentedI 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.
Comment #17
harcher CreditAttribution: harcher commentedDefenitly 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.
Comment #18
quicksketchOkay 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.
Comment #19
harcher CreditAttribution: harcher commentedThanks 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?
Comment #20
quicksketchOur 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.
Comment #21
harcher CreditAttribution: harcher commentedMakes sence. Will try and report back. Thanks again :)
Comment #22
harcher CreditAttribution: harcher commentedApplied 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.
Comment #23
quicksketchSee #841212: warning: array_merge() [function.array-merge]: Argument #1 is not an array in..../filefield_field.inc on line 292..