Could I suggest initializing the $files variable in filefield_get_node_files() to an empty array, that way external callers won't have to check the return prior to iterating in a foreach loop.

Currently if no files are attached to a node, then a NULL is returned and foreach throws warnings.

function filefield_get_node_files($node, $field = NULL) {
  $files = array();
  ...

  return $files;
}

Thanks,

Ron.

Comments

quicksketch’s picture

Priority: Normal » Critical
Status: Active » Fixed

Certainly. A small error on my part. Thanks!

http://drupal.org/cvs?commit=218292

rjerome’s picture

Great, thanks.

Ron.

quicksketch’s picture

Priority: Critical » Minor

Now why'd I mark that critical...

Status: Fixed » Closed (fixed)

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