Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
quicksketchCertainly. A small error on my part. Thanks!
http://drupal.org/cvs?commit=218292
Comment #2
rjerome CreditAttribution: rjerome commentedGreat, thanks.
Ron.
Comment #3
quicksketchNow why'd I mark that critical...