I just created a new content type, added a few fields (3 text, 1 File) and tried to create an item of content to test with, and I got this error message when I hit submit:

notice: Undefined index: data in content_storage() (line 1031 of sites/all/modules/cck/content.module)

The line in question seems to be looping through a list of fields - none of my fields are called data.

PHP 5.3.3, Drupal 6.22

Comments

vectoroc’s picture

The notice was appearing on filefield fields (list and description are disabled) and has disappeared after enabling description option

the same issue few months ago #1034428: Notice: Undefined index: data in content_storage() (line 1071 of /sites/all/modules/contrib/cck/content.module).

reikiman’s picture

I'm getting a slightly different message (different line number) upon posting a new node:-

Notice: Undefined index: data in content_storage() (line 1074 of /srv/bindings/ab331aab8e404f6d89add5010badaee5/code/sites/all/modules/cck/content.module).
	Notice: Undefined index: data in content_storage() (line 1074 of /srv/bindings/ab331aab8e404f6d89add5010badaee5/code/sites/all/modules/cck/content.module).
	Notice: Undefined index: data in content_storage() (line 1074 of /srv/bindings/ab331aab8e404f6d89add5010badaee5/code/sites/all/modules/cck/content.module).

I found that this change makes the message go away -- that is, there's an existing guard test, so the change makes a slight extension to that test.

diff --git a/sites/all/modules/emfield/emfield.cck.inc b/sites/all/modules/emfield/emfield.cck.inc
index 757513b..1f16ab2 100644
--- a/sites/all/modules/emfield/emfield.cck.inc
+++ b/sites/all/modules/emfield/emfield.cck.inc
@@ -114,7 +114,7 @@ function _emfield_emfield_field($op, &$node, $field, &$items, $teaser, $page, $m
   if (in_array($op, array('insert', 'update'))) {
     foreach ($items as $delta => $item) {
       // We need to manually serialize the 'data' array.
-      if(is_array($items[$delta]['data'])){
+      if(array_key_exists('data', $items[$delta]) && is_array($items[$delta]['data'])){
         $items[$delta]['data'] = serialize($items[$delta]['data']);
       }
     }