I am developing a site using the current HEAD from the CVS, and have created a content type called "Release" that details a release from an artist that we manage.
The date has been saved in the database, but when I try to view the item, I get these two error messages:
Warning: Invalid argument supplied for foreach() in C:\apache2\htdocs\nhm\modules\cck\date.module on line 85
Warning: Invalid argument supplied for foreach() in C:\apache2\htdocs\nhm\modules\cck\content.module on line 878
I've had a look inside the code and it seems to come from an array called $items:
content.module:
foreach ($items as $item) {
$output .= '<div class="field-item">'. $item['view'] .'</div>';
}
date.module:
foreach ($items as $delta => $item) {
$items[$delta]['view'] = content_format($field, $item, 'default', $node);
}
In the function theme_field in content.module, I can see a reference to an array being passed in (&$items) but NOT in function date_field in date.module, so I am at a lost to what seems to be going on here?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | screenshot2_2.png | 80.35 KB | tanepiper |
Comments
Comment #1
tanepiper commentedOh, and I've got devel installed, which shows the array as correct:
Comment #2
tanepiper commentedHaha - I still have the problem, but I have narrowed it down. The above errors only seem to appear when Node:Body is used in a view, or at least thats when it happens for me.
I was building a custom list view to show a list of releases, and built it up one field at a time and it was only when I added Node:Body that these error started to appear. Hope this helps in tracking down the problem.
Comment #3
tanepiper commentedI've managed to define the problem even more. In a List or Table view, I still get the warning messages - but the date WILL show in the view. However, in a full node view, the date is not displayed on the screen.
Comment #4
karens commentedI can't replicate this using latest versions of everything.
Note that the body field is no longer required, thanks to a recent update to core, so in some cases it won't exist. But I tried creating a content type without a body and adding a date field and the body to the view, and then adding a body to the content type and viewing it, and in both cases it worked fine.
Just in case the fact that the handling of body changed has something to do with this, try pulling up your content type and saving it again, then pulling up your view and saving it again, then try to view it and see if there is still a problem.
Comment #5
tanepiper commentedOk, I've deleted my views and content types and here is what I do step-by-step:
I then Add a test release, this is without yet defining a view (as I have deleted my previous view) and I still get the error of the date not showing. I've attached a screenshot to show this not working.
Here is the output from devel load
Comment #6
karens commentedAre you sure you have latest versions? Your screenshot indicates an error on line 85 of the date module and there is no array on that line in the current version. Also, there is no such thing as Granularity:Date so I don't know what you selected there.
Comment #7
tanepiper commentedContributions Directory:
:pserver:anonymous@cvs.drupal.org:/cvs/drupal
Repository: contributions
Sticky tag/date: Head
Drupal Directory:
:pserver:anonymous@cvs.drupal.org:/cvs/drupal
Repository: drupal
Sticky tag/date: Head
So I assume, yes I am running the current versions? Tell me if I'm wrong? It's definetly version 5 of Drupal I am running, and CCK and the date.module (from the header: // $Id: date.module,v 1.25 2006/10/24 12:16:16 karens Exp $)
I am running the date.module from my CCK directory, not from it's own one, could that be affecting it?
Comment #8
tanepiper commentedAhh, thats seems to have been the problem all along! I removed the files from my CCK directory and uploaded date to it's own directory in the modules directory, and the admin fields have changed!
I'll give it a try now.
Comment #9
tanepiper commentedYep, that fixed the problem
Comment #10
karens commentedGood. Thanks for reporting back instead of leaving this open!