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'];
}

Comments

kevinchampion’s picture

Status: Active » Needs review
StatusFileSize
new479 bytes

Patch attached:

das-peter’s picture

Thank 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.

coredumperror’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #1 worked for me! We're using a highly customized version of MBP 2, so upgrading to MBP3 wasn't an option.

das-peter’s picture

Status: Reviewed & tested by the community » Fixed

Hmm, I don't want to slowdown this any further and since we've now another report that this works committed
Thanks guys!

Status: Fixed » Closed (fixed)

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