Hi to all,

I'm testinfg this module... in conjunction with Transliteration on a fresh test site.

The module seems work but this error appear at the end of Upload process (when all images are displayed and before saving the node)

This is the message:

warning: implode() [function.implode]: Invalid arguments passed in /var/wwwroot/mysite/sites/all/modules/filefield/filefield_widget.inc on line 189.

Some ideas about?

Comments

Jean Gionet’s picture

I'm getting the exact same error! Any solutions for this? thxs

yan’s picture

Same error with

Drupal core 6.20
ImageField 6.x-3.9
ImageField zip support 6.x-1.0-beta2
PHP 5.2.6-1+lenny9
jQuery UI 1.7.3
jQuery Update 1.3.2

Dret’s picture

Priority: Normal » Major

I moved to this module http://drupal.org/project/jifupload : has no support for .zip but works perfectly!

tuoermin’s picture

Same problem. For each picture in ZIP file I get the following warnings:

# warning: Parameter 1 to filefield_validate_associate_field() expected to be a reference, value given in /home/drupal/sites/all/modules/imagefield_zip/imagefield_zip.ahah.inc on line 179.
# warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/drupal/sites/all/modules/imagefield_zip/imagefield_zip.ahah.inc on line 179.
# warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/drupal/sites/all/modules/imagefield_zip/imagefield_zip.ahah.inc on line 179.
# warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/drupal/sites/all/modules/imagefield_zip/imagefield_zip.ahah.inc on line 179.
# warning: Parameter 1 to filefield_validate_is_image() expected to be a reference, value given in /home/drupal/sites/all/modules/imagefield_zip/imagefield_zip.ahah.inc on line 179.
# warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/drupal/sites/all/modules/imagefield_zip/imagefield_zip.ahah.inc on line 179.
# warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/drupal/sites/all/modules/imagefield_zip/imagefield_zip.ahah.inc on line 179.
# warning: implode() [function.implode]: Invalid arguments passed in /home/drupal/sites/all/modules/filefield/filefield_widget.inc on line 189.
Renee S’s picture

Are y'all running PHP5.3? This looks like one of *those* errors. I'll try changing the function call to: call_user_func_array($function, &$args); (passing args by reference) and report back :)

UPDATE: No, this doesn't fix it...

OK, this looks like there's a problem in the overridden file_save_upload function. Some of the functions used for validation take arguments differently than they're being passed. Taking a look.

Renee S’s picture

Ok, most of the errors can be fixed by adding

$args[0] = &$file;
above
$errors = array_merge($errors, call_user_func_array($function, $args));

on line 179. This is actually a fix added to filefield already.

However, it appears that a secret not-well-documented form element isn't being set, which leads to the implode errors.

The line in filefield_widget that's still giving an error is $upload_name = implode('_', $element['#array_parents']); Does anybody with FAPI experience know where this should be set, or why it isn't being set?

tfranz’s picture

I've the same problem – any solution on this?
Couldn't find the lines above ...

ImageField Zip Extract 6.x-1.0-beta2
FileField 6.x-3.10

richH’s picture

Hi,

also got the same thing :-(

I've tried replacing the implode() function call in filefield_widget.inc at line 180ish, with a foreach as shown

foreach($element['#array_parents'] as $part)
    $upload_name .= $part . '_';
  $upload_name = rtrim($upload_name,'_');

but I get a foreach error because $element['#array_parents'] is NULL. If I prefix this code with a check for null arrays as shown:

if(!isset($element['#array_parents'])) return 0;
  foreach($element['#array_parents'] as $part)
    $upload_name .= $part . '_';
  $upload_name = rtrim($upload_name,'_');

then this works for one image and then stops - but without errors.

Unfortunately I don't know where $element is being created or what it contains. Actually I don't even really know how to do a var_dump() which is making this debug quite hard ;-)

I added in a bunch of things to get some output as shown below:

form_set_error('a', t('Count element: @elementCount',array('@elementCount'=>count($element['#array_parents']))));
  form_set_error('b', t('Element zero: @first',array('@first'=>$element['#array_parents'][0])));
  form_set_error('b1', t('Element one: @first',array('@first'=>$element['#array_parents'][1])));
  
  $upload_name = '';
  if(!isset($element['#array_parents'])) return 0;
  foreach($element['#array_parents'] as $part)
    $upload_name .= $part . '_';
  $upload_name = rtrim($upload_name,'_');
  form_set_error('b2', t('My name: @name',array('@name'=> $upload_name)));

and get this output:

Count element: 2
Element zero: field_foto
Element one: 0
My name: field_foto_0

If I remove all the form_error output I still only get one single file uploaded just incase this call terminates the process. Am a bit of a newbie with drupal coding and haven't read the manual yet!!

Cheers
Rich

mikeytown2’s picture

Status: Active » Fixed

This issue has been fixed in the latest dev. see #1281916: Emulate CCK/Filefield better for the diff.

Status: Fixed » Closed (fixed)

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

barteque’s picture

if #9 working?
I'm looking at the diffs and can't find those lines in my module files

mikeytown2’s picture