Posted by rychu90 on August 11, 2012 at 11:20am
6 followers
| Project: | Media |
| Version: | 7.x-1.x-dev |
| Component: | Media field |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I added field "description" to image file type. Everything went ok but when i tried to fill this field under admin/content/media and saved it i see this message:
Notice: Undefined index: file in media_edit_submit() (line 366 of (...)\drupal\sites\all\modules\media\includes\media.pages.inc).
EntityMalformedException: Missing bundle property on entity of type file. in entity_extract_ids() (line 7562 of (...)\drupal\includes\common.inc).
Comments
#1
#2
I have attached a patch that fixes this issue for me.
I believe this is caused $form_state is not passed by reference to the function media_edit. So right now:
function media_edit($form, &$form_state, $file) {$form_state['file'] = $file;
Doesn't affect $form_state outside of the form. Then in
function media_edit_submit($form, &$form_state) {$file = $form_state['file'];
The file is not actually in $form_state.
#3
The last submitted patch, media-pass_form_state_byref_media_edit-1723820-2.patch, failed testing.
#4
confirmed that this is an issue in 7.x-1.-dev.
Also, I tried the patch in #2 and I believe it is the correct solution. Obviously we need to figure out why its failing though...
#5
Ok, If you click view details for the patch you will see that all the exceptions(no errors found) are similar to this:
With different line numbers.
Is this an existing problem in Media? I don't see how my patch could have caused this. But this is the first time I have looked at Media's code.
#6
Thanks, I committed #2 to Git. http://drupalcode.org/project/media.git/commit/6d25709
We can fix the test failures separately.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.