warning: Invalid argument supplied for foreach()

jaxpax - December 2, 2008 - 23:02
Project:NodeReferrer
Version:6.x-1.x-dev
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Drupal - 6.5
NodeReferrer - 6.x-1.x-dev
CCK - 6.x-2.1
Views - 6.x-2.1

This module has really become one of the most important part of my Drupal site. It's awesome, but there are some errors.

I have created 3 content types, a parent, child and grandchild. I sometimes get errors like this:
# warning: Invalid argument supplied for foreach() in /home/sites/konsultblog.com/public_html/sites/all/modules/nodereferrer/nodereferrer.module on line 251.

What is wrong and how can I fix this.

#1

wrb123 - December 4, 2008 - 16:36

I am having this same error message appear when creating a parent/top item in the hierarchy. It does not seem to affect anything, yet is annoying because it appears to users :/ (drupal 6.6)
This is a great module and I would love a patch for this.

#2

wrb123 - December 4, 2008 - 16:51

P.S. - this is also happening after middle/child node creation, but does not seem to ever happen during bottom/grandchild node creation.

#3

wrb123 - December 4, 2008 - 16:55

P.S. - this is also happening after middle/child node creation, but does not seem to ever happen during bottom/grandchild node creation.

#4

jaxpax - December 5, 2008 - 19:35

That's right, the same for me. I was a little to vague in my explanation. To be more specific: I'm using Node Referrer and want to use a drag n drop feature that comes with that module. What I want to do is to sort my nodes, in a View, in a specific order, only using the node title, and when I hit the save button the error pops up. I also have a different View with the same nodes but this View contains both title and body text, in the order specified in the previously explained View. The strange thing here is that the View present the nodes, but without any errors.

#5

Flying Drupalist - December 6, 2008 - 23:24

subscribe

#6

DamienMcKenna - July 22, 2009 - 05:44

After coming across this myself in 6.x, I suggest doing some testing to ensure the node variable being passed in is a complete node and not NULL; my error stemmed from a typo, once I fixed the typo it worked again.

#7

andypost - October 4, 2009 - 17:31
Version:5.x-1.x-dev» 6.x-1.x-dev
Status:active» postponed (maintainer needs more info)

I see that related to 6.x branch not 5

So is this still an issue?

#8

jcfiala - October 13, 2009 - 22:19

I'm getting an error while running cron at line 451 in 6.x-beta2.

<?php
$type
= content_type($node->type);
foreach (
$type['fields'] as $field)...
?>

Could it be some node types doesn't have a 'fields' array attached to it because it has no cck fields yet?

#9

andypost - October 14, 2009 - 07:38

@jcfiala Error or warning? if no fileds attached then empty array is returned, so I see no problem with this code. Could you explain what cck version are you using?

#10

Goofy2k - November 26, 2009 - 14:37

subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.