nvalid argument...in cck/content.module on line 192 AND in cck/content_admin.inc on line 18

MsDetta - December 18, 2006 - 19:05
Project:ContentO
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

First time using CCK to create a content type received above errors. I had created a new content type called college and added a field named college name, when adding the next field called address, started receiving the above errors. The foreach statement is line 192.

Line 192 function:

function content_node_info() {
  $types = array();
  foreach (content_types() as $name => $type) {
    $types[$name] = array('name' => t($type['label']), 'base' => 'content');
  }
  return $types;
}

I think this might be the fix (at least it turned off the line 192 error):

function content_node_info() {
  $types = array();
  foreach ($types as $type_name => $type) {
    $types[$type_name] = array('type_name' => t($type['label']), 'base' => 'content');
  }
  return $types;
}

In cck/content_admin.inc on line 18 is the foreach statement:

function _content_admin_type_overview() {
  $types = content_types();

  $header = array(t('Label'), t('Name'), t('Description'), array('data' => t('Operations'), 'colspan' => 3));
  $rows = array();
  foreach ($types as $type) {
    $row = array();
    $row[] = l(t($type['label']), 'admin/node/types/'. $type['type_name'] .'/fields');
    $row[] = $type['type_name'];
    $row[] = $type['description'];

    $row[] = l(t('edit'), 'admin/node/types/'. $type['type_name']);
    $row[] = l(t('duplicate'), 'admin/node/types/'. $type['type_name'] .'/duplicate');
    $row[] = l(t('delete'), 'admin/node/types/'. $type['type_name'] .'/delete');

    $rows[] = $row;
  }

  $output = theme('table', $header, $rows);

  return $output;
}

What does the foreach statement need to be for line 18? Does $row[] = $type['type_name']; need to be before $row[] = l(t($type['label']), etc.?

Other installed modules:
Actions
Banner
Blockcache
Captcha
Ecommerce
Files
Forms
Login_toboggan
Nodefamily
Nodelimit
Nodeprofile
Nodereference
Pageroute
Premium
Profile
Rolesignup
Tinymce & Imce
User_import
User_readonly
Usernode
Webform
Workflow

I turned off Views and Views_fusion.

System Information
Linux
Apache version 1.3.37 (Unix)
PHP version 5.1.6
MySQL version 4.1.21-standard

#1

MsDetta - December 19, 2006 - 20:21
Status:active» closed

Still don't know what caused this. After clearing the cache, I fixed it by deleting all the information in the database node_type_content, node_field, node_fileld_instance, and deleted the newly created node_content_college table.

I removed all the other node modules. I restored the original content.module file, and turned on each of the other CCK modules one at a time.

Fixed.

#2

MsDetta - December 24, 2006 - 01:46

Posting a follow up because this is still happening, but I've figured out why. With CCK, you have to be careful how you name your fields. In one instance, I just used the field name as zip and once again, I got both erros and had to delete fields in the mySQL database and then clear the cache.

 
 

Drupal is a registered trademark of Dries Buytaert.