Notice: Undefined index: undefined in plup_field_attach_presave() (line 602 of ...\sites\all\modules\plup\plup.module).
I get this error on every page refresh where a field is displayed with Plupload widget used.
It's because $bundle can sometimes be equal to "undefined" when using file_entity module.
$entityFields = $instances[$entity_type][$bundle];
I think it's in connection with this update:
look at file_entity_update_7202():
/**
* Drupal 7.8 disallows empty string as the value for a bundle key, so update
* empty {file_managed}.type records to 'undefined' instead.
*/
function file_entity_update_7202() {
db_update('file_managed')
// Using 'undefined' instead of FILE_TYPE_NONE, because update functions can
// run for disabled modules.
->fields(array('type' => 'undefined'))
->condition('type', '')
->execute();
}
So I think $bundle variable should be checked:
if($bundle !== 'undefined')
OR isset() should be used:
$entityFields = isset($instances[$entity_type][$bundle]) ? $instances[$entity_type] : NULL;
Thanks for the corrections in advance.
Comments
Comment #1
Sk8erPeter commentedI attached a simple patch which can solve the problem.
Comment #2
deanflory commentedPatch failed when attempted on the latest dev version of plup (2012-Jul-04):
Comment #3
Sk8erPeter commentedyes, because there are some really silly modifications in Plup's current dev release... it looks like it's full of test codes. For example:
$items['pluptest'],function plup_test_form(),function plup_test_form_submit(), etc... I don't know why it was committed like this, ask the maintainer.When I created the patch, it applied successfully. Now it seems like the module's got a brand new code, but I really don't understand why the developer didn't create another branch (like 7.x-2.x-dev or sg like this) instead of rewriting the whole code...
Comment #4
wreckage commentedHello there.
Is there any known resolution for this problem? I'm new to Drupal and am trying to get a user photo gallery together, but Plupload is giving me the below error also:
Notice: Undefined index: file in plup_field_attach_presave() (line 585 of /mounted-storage/home2/sub002/yada-yada/MySiteName/sites/all/modules/plup/plup.module).
Any help or assistance with this will be greatly appreciated. Thank-you.
Comment #5
orbistertius commentedThe patch failed tests because it missed the bundle
This works for me.
Comment #5.0
orbistertius commentedsimplifying code
Comment #6
patoshi commented#5 confirmed working.
anyone re-roll a new patch for this?
Comment #7
kenorb commentedComment #8
ericwenger commented#5 worked for me also