With the latest development versions of file_entity, media, and media_browser_plus installed, after uploading a file with the media browser and clicking the "next" button, the following error is triggered:
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /includes/entity.inc).
This is being triggered by a null value for $fids in media_browser_plus_submit() in media_browser_plus.module when it tries to load the file/s from $fids using file_load_multiple() on line 383:
$media_entities = file_load_multiple($fids);
The new file_entity form structure uses a multiform approach and thus stores values in $form_state['storage']. As a result, we have to look in $form_state['storage']['upload'] to find the fid of the file. To remedy this, we can add to the conditional that attempts to retrieve the fid/s from the form_state on line 379:
elseif (isset($form_state['storage']['upload'])) {
$fids = $form_state['storage']['upload'];
}
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | fid_capture_on_submit-1952620-0.patch | 479 bytes | kevinchampion |
Comments
Comment #1
kevinchampion commentedPatch attached:
Comment #2
das-peter commentedThank you very much for the patch!
May I ask you to you give MBP 3.0 beta1 a try?
I think the problem is already solved in 3.x.
My goal is to discontinue the support for version 2.x as soon as possible.
Comment #3
coredumperror commentedPatch in #1 worked for me! We're using a highly customized version of MBP 2, so upgrading to MBP3 wasn't an option.
Comment #4
das-peter commentedHmm, I don't want to slowdown this any further and since we've now another report that this works committed
Thanks guys!