I'm running Drupal 5 RC1 with CCK 5.x-1.x-dev (snapshot dated 2007-Jan-01) on OS X Server 10.4.8 (PHP 5.1.4, MySQL 5.0.25-standard, and Apache 1.3.33) and CCK nodes types are not working. Everything else works fine so far with Drupal 5 RC1, but when I create a new CCK node from a CCK content type I defined, the page returns PHP warnings and doesn't display any data from that CCK node. For example, I created a CCK content type that has 5 fields, for each field I get the following error when trying to view that node in Drupal:

# warning: array_reverse() [function.array-reverse]: The argument should be an array in /drupal-5.0-rc1/themes/engines/phptemplate/phptemplate.engine on line 365.
# warning: Invalid argument supplied for foreach() in /drupal-5.0-rc1/themes/engines/phptemplate/phptemplate.engine on line 366.

Because I have 5 fields in this CCK content type, I get 10 warnings (2 for each field). Viewing a regular page node in Drupal 5 RC1 works fine, it's just the CCK content type that seems to fail. Any ideas?

Is there a more recent snapshot of Drupal 5 RC1 that I should try?

Comments

yched’s picture

Strange... Plus I can't seem to reproduce.
Could you do an export of your content type with all the fields (admin/content/types/export) and paste the result here ?

yched’s picture

forgot to add : you need to enable 'content_copy' module in order to do the export (it's included in the cck bundle)

johnnyd’s picture

Here's the export:

$content[type] = array (
'name' => 'COE Page',
'type' => 'coe_page',
'description' => 'This is a CCK page.',
'title_label' => 'Title',
'body_label' => '',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => false,
'sticky' => false,
'revision' => false,
),
'comment' => '0',
'old_type' => 'coe_page',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
);
$content[fields] = array (
0 =>
array (
'widget_type' => 'text',
'label' => 'Banner Image',
'weight' => '0',
'rows' => '1',
'description' => '',
'group' => false,
'required' => '0',
'multiple' => '0',
'text_processing' => '0',
'max_length' => '',
'allowed_values' => '',
'allowed_values_php' => '',
'field_name' => 'field_banner_image',
'field_type' => 'text',
'module' => 'text',
),
1 =>
array (
'widget_type' => 'text',
'label' => 'Banner Text',
'weight' => '0',
'rows' => '1',
'description' => '',
'group' => false,
'required' => '0',
'multiple' => '0',
'text_processing' => '1',
'max_length' => '255',
'allowed_values' => '',
'allowed_values_php' => '',
'field_name' => 'field_banner_text',
'field_type' => 'text',
'module' => 'text',
),
2 =>
array (
'widget_type' => 'text',
'label' => 'Banner Text Location',
'weight' => '0',
'rows' => '1',
'description' => '',
'group' => false,
'required' => '0',
'multiple' => '0',
'text_processing' => '0',
'max_length' => '',
'allowed_values' => '',
'allowed_values_php' => '',
'field_name' => 'field_banner_text_location',
'field_type' => 'text',
'module' => 'text',
),
3 =>
array (
'widget_type' => 'text',
'label' => 'Content',
'weight' => '0',
'rows' => '75',
'description' => '',
'group' => false,
'required' => '1',
'multiple' => '0',
'text_processing' => '1',
'max_length' => '',
'allowed_values' => '',
'allowed_values_php' => '',
'field_name' => 'field_content',
'field_type' => 'text',
'module' => 'text',
),
4 =>
array (
'widget_type' => 'text',
'label' => 'Header Code',
'weight' => '0',
'rows' => '25',
'description' => '',
'group' => false,
'required' => '0',
'multiple' => '0',
'text_processing' => '0',
'max_length' => '',
'allowed_values' => '',
'allowed_values_php' => '',
'field_name' => 'field_header_code',
'field_type' => 'text',
'module' => 'text',
),
);

karens’s picture

I imported this into a current version and it works fine, no error messages, so I can't reproduce this either. The errors are coming from the template engine, so I wonder if this is a theme problem. Have you made template changes? What happens if you switch to the standard display using the Garland theme (don't use any custom templating at all).

johnnyd’s picture

Category: bug » support
Status: Active » Closed (fixed)

TBLFS (tail between legs and feeling stupid) It was my theme changes. Once I used the built-in theme, the problem went away. Thanks!

lunas’s picture

What kind of changes did you make? I'm getting the same errors, trying to pinpoint what the problem is in my theme...

johnnyd’s picture

It all boiled down to the changes in how 4.7 and 5.0 parsed theme files. My theme worked in 4.7, but not in 5. I just converted my theme and it worked fine.

stewzy’s picture

Not to sure of how to add this comment... but this is something to try for the array_reverse deal...

not a pro, but I added the following to themes/engines/phptemplate/phptemplate.engine, and it seems to work...

// Loop through any suggestions in FIFO order.
if (is_array($suggestion)){

	  $suggestions = array_reverse($suggestions);
	  foreach ($suggestions as $suggestion) {
	    if (!empty($suggestion) && file_exists(path_to_theme() .'/'. $suggestion . $extension)) {
	      $file = path_to_theme() .'/'. $suggestion . $extension;
	      break;
	    }
	  }

}

stewzy’s picture

ummm.. that should have said

if (is_array($suggestions)){