The following notice has cropped up for me since I upgraded to Drupal 6.18. This is due to the improved reporting capabilities I am led to believe.

Notice: Undefined index: in _content_get_formatter() (line 1380 of D:\sites\testsite\sites\all\modules\cck\content.module).

This notice was occuring when I was using Views to aggregate 3 different node types with unique fields from each in the display. When the fields were being passed through to this function the $field_type variable was sometimes being set to an empty string which was causing the undefined index error that is being reported.

I'm not sure what the best way to fix this would be as I am unsure whether the function should return false or a string of 'default' in this situation.

Any help would be greatly appreciated.

Regards,
Tim

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

timhilliard’s picture

FileSize
442 bytes

I have created a patch that seems to fix it but would like someone to check it for me.

Thanks,
Tim

timhilliard’s picture

Status: Active » Needs review

Changing to needs review

mikeytown2’s picture

Title: Upgrade to Drupal 6.18 exposing php notice errors » Notice: Undefined index: in _content_get_formatter()
Version: 6.x-2.8 » 6.x-2.x-dev
Status: Needs review » Reviewed & tested by the community
FileSize
1.15 KB

patch also has some white space fixes in as well...

yched’s picture

Status: Reviewed & tested by the community » Fixed

committed a different fix (http://drupal.org/cvs?commit=448974)
rather fix the error at the source rather that babysit broken calls in underlying functions.

Committed to the 2.x and 3.x branches.

Status: Fixed » Closed (fixed)

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

beeradb’s picture

Those of us using drush_make need a patch to properly add this to our build process.

The attached patch is against 2.8.

yched’s picture

Thks beeradb - "no commits without a patch in the queue" is definitely good practice, but I often skip it :-/

To be clear: the patch in #6 is the same as the one that got committed, and is just for history's sake. The issue is fixed in -dev (2 and 3)

beeradb’s picture

@yched No problem. To be clear, my comment wasn't a criticism of you for not attaching the patch, but just an explanation as to why I'd bother to post a patch to the queue a couple weeks after it had been fixed in dev.

Wanted to make sure anyone who saw it didn't get too confused :)

Bedstvie’s picture

Version: 6.x-2.x-dev » 6.x-2.6
FileSize
890 bytes
Bedstvie’s picture

FileSize
890 bytes

The error occurs because of the fact that the function content_fields not always return value