I have turned up the level of error reporting with an upgrade to Drupal 6.20 in preparation for the leap to Drupal 7. Our intent is to have as relatively few errors, warning and notices as we can with the upgrade to Druapl 6.20 and PHP 5.3 before the introduction of the Drupal 7 changes. As a result, we discovered a case of an undefined variable with this module. The error message came up as:
notice: Undefined index: fid in filefield_widget_value() (line 238 of /home/toomreco/drupal-6.20/sites/all/modules/filefield/filefield_widget.inc).
I believe the fix is to initialize the $file variable to NULL and then to wrap the line of code in an isset() like as follows:
// Load file if the FID has changed so that it can be saved by CCK.
$file = NULL;
if (isset($item['fid'])) {
$file = field_file_load($item['fid']);
}
Perhaps this can be included in the development version so similar warnings do not appear for others?
Cheers!!
Comment | File | Size | Author |
---|---|---|---|
#1 | filefield_widget_notice.patch | 508 bytes | quicksketch |
Comments
Comment #1
quicksketchThanks, corrected with this patch.
Comment #3
Lars Toomre CreditAttribution: Lars Toomre commentedYour patch was a more elegant on line solution... Nicely done!