Notice: Undefined index: data in content_storage() (line 1071 of /sites/all/modules/contrib/cck/content.module).

Comments

KarenS’s picture

Status: Active » Fixed

Unable to replicate this problem. And I can find no reference to anything called 'data' on that line, or anywhere else in that function in the current code.

Status: Fixed » Closed (fixed)

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

gateway69’s picture

Status: Closed (fixed) » Active
Issue tags: +CCK, +undefined index

Sorry I had to open this, I just ran into this today on a fresh install of drupal on my ubuntu system..

I see about 4 or so undefined indexes when adding a new content to a content type.

the above one is valid but im also seeing these

Notice: Undefined index: data in content_storage() (line 1031 of /var/www/sites/all/modules/cck/content.module).
Notice: Undefined index: fid in content_storage() (line 1031 of /var/www/sites/all/modules/cck/content.module).
Notice: Undefined index: list in content_storage() (line 1031 of /var/www/sites/all/modules/cck/content.module).

this is the line of code

              $record[$attributes['column']] = $node->{$field_name}[0][$column];

I no php guru but if i can help debug let me know..

chromix’s picture

I also started seeing this error pop up when using the Link module.

http://drupal.org/node/830432#comment-5263232

This is with 6.x-2.9, I should point out. Changing line 1031 to this worked perfectly, though:

if (isset($node->{$field_name}[0][$column])) $record[$attributes['column']] = $node->{$field_name}[0][$column];
brad.bulger’s picture

just a note to anyone else researching this error - it looks as if CCK is expecting the node field value to have all of the keys returned by content_database_info() for the field type, and some modules that define field types are not doing that. see #2078651: Notice: Undefined index: url in content_storage(), for example. so i guess the question is, is that a reasonable expectation, so that the problem is really on the module defining the field type to meet it, or should CCK handle the case when the column is undefined? a change that would preserve current behavior but prevent notices would be more like

if (isset($node->{$field_name}[0][$column])) {
  $record[$attributes['column']] = $node->{$field_name}[0][$column];
}
else {
  $record[$attributes['column']] = NULL;
}

so that it still creates the key/value pair in $record.