Small patch to remove notices from the filefield widget.

RCS file: /cvs/drupal-contrib/contributions/modules/filefield/,v
retrieving revision 1.86
diff -u -b -r1.86
---        20 Apr 2009 22:51:44 -0000      1.86
+++        21 Apr 2009 07:36:01 -0000
@@ -353,7 +353,7 @@
     '#access' => !empty($item['fid']),
-  if ($field['description_field']) {
+  if (isset($field['description_field']) && $field['description_field']) {
     $element['data']['description'] = array(
       '#type' => 'textfield',
       '#title' => t('Description'),
@@ -363,7 +363,7 @@
-  if ($field['list_field']) {
+  if (isset($field['list_field']) && $field['list_field']) {
     $element['list'] = array(
       '#type' => empty($item['fid']) ? 'hidden' : 'checkbox',
       '#title' => t('List'),
Members fund testing for the Drupal project. Drupal Association Learn more


dawehner’s picture

Status: Active » Needs review

this makes total sense for me, and patch works fine here.

isn't !empty($foo) the same as isset($foo) && $foo

quicksketch’s picture

Yep, I'll probably switch out the conditional with !empty(), otherwise looks good.

pletcher’s picture

Found another, now with new !empty().

RCS file: /cvs/drupal-contrib/contributions/modules/filefield/,v
retrieving revision 1.13
diff -b -r1.13
<   if ($field['list_field']) {
>   if (!empty($field['list_field'])) {
quicksketch’s picture

Status: Needs review » Fixed
1.71 KB

3 instances fixed with attached patch.

quicksketch’s picture

Excuse me, 4 instances fixed. :-)

Status: Fixed » Closed (fixed)

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

fabius’s picture

I just upgraded a site to 6.12 and upgraded all the modules to latest versions. Images no longer display and I cannot edit the nodes. When I click EDIT the error message is:

Fatal error: Cannot unset string offsets in public_html/modules/filefield/ on line 441

There is no line 441 . . . . and I know only a little about php.

I am using CCK, Composite Layout, ImageCache and ImageField, etc


fabius’s picture

120.58 KB

The problem reported above is fixed. I logged out and let it "settle" for a hour or so. When I logged back on, Drupal told me to update the database - then things worked fine (just one problem with i18n module, which won't recognise the update).

Faith restored.

Question if I have your attention:
The node edit page works fine for me but on this site the owner (a real estate agent) does all the content using the special page type I created. The various modules do not seem to be smoothly integrated for what should be a routine task. Is there a better approach?

jpg list of relevant modules attached.