Firstly thanks for all your work on the module. It's an essential part of any Drupal installation.

But have you got any ideas why this is coming up as a PHP error? I've never encountered this before.

Invalid argument supplied for foreach() in /home/cotton/public_html/dalstonair.org.uk/sites/all/modules/cck/content.module on line 1155.

Regards,

Andy

Comments

yched’s picture

Status: Active » Postponed (maintainer needs more info)

Please provide more info :
when exactly does this error occur, after doing what, when viewing what page, what fields are in the involved content type(s) ...

mthorblad’s picture

Have the same thing , it is on the start page , node1 and it is only for people that are not registed on my page

AndyW’s picture

Thanks for responding.

It happens when I enable the content module - and only on the front page at the top of the content field where nodes are displayed.

AntinOz’s picture

It is happening for me as well. The line numbers changed with the RC3 upgrade. It is happening both for registered and unregistered users and is happening on my blog page and also, strangely, when I run Cron manually as user 1.

Ant.

AndyW’s picture

For the moment I've switched off the php error alert - it just logs it to the file rather than displays it on the frontpage.

I haven't noticed any other problems with the module other than the php error display

dopry’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Looks like content.module trying to load data for content that doesn't have CCK fields... Should be fixed by the patch here: http://drupal.org/node/107407. please test.

yched’s picture

@dopry : this will probably fix the symptom (error message), but not the underlying problem. $type['fields'] is supposed to always be at least an empty array, so foreach() shouldn't choke on it.
This kind of errors typically mean some module conflict, but this has always proved very hard to pin. Fixing the symptom is probably the best option anyway...

AntinOz’s picture

@dopry: This appears to have stopped the error (or symptom anyway).

Ant.

matt.nz’s picture

Getting the same problem:
Invalid argument supplied for foreach() in /home/htdocs/modules/cck/content.module on line 1066.

Have recently moved to a new server and this issue appears to have popped up with 3.x

I'm not sure if it is related, but something is causing nodes on my site that are saved to save the title only! In other words, every other body/cck field is being wiped out!!

pfeff’s picture

I had similar problems to this. Turns out the reason was I'd deleted the anonymous user - uid=0.

I installed this module which creates uid=0 if it doesn't exist. Fixed the problems.

http://drupal.org/project/anonymous_user

leon0909’s picture

It happened to me,
as I've accedently deleted a return statement at the end of the view function, in one of the first custom modules I was writing.

ahh yep this was a...

return $node;

So take care and happy coding!)