Using Drupal head after RC3 (couple of days ago)

Add CCK node type - OK
Add text field - OK
Create new node of this type - OK
Add nodereference field [select list, no extra boxes checked, associated w/ anothe CCK node type] - OK
Create a new node of this type - get errors below

Warning: Invalid argument supplied for foreach() in C:\workspace\mysite\modules\node.module on line 359
Call Stack
#	Function	Location
1	call_user_func_array ()	C:\workspace\mysite\includes\menu.inc:418
2	call_user_func_array ()	C:\workspace\mysite\includes\theme.inc:166

Warning: implode() [function.implode]: Bad arguments. in C:\workspace\mysite\modules\node.module on line 363
Call Stack
#	Function	Location
1	call_user_func_array ()	C:\workspace\mysite\includes\menu.inc:418
2	call_user_func_array ()	C:\workspace\mysite\includes\theme.inc:166
3	implode ()	C:\workspace\mysite\modules\node.module:363

Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in C:\workspace\mysite\includes\database.mysql.inc on line 120
Call Stack
#	Function	Location
1	call_user_func_array ()	C:\workspace\mysite\includes\menu.inc:418
2	call_user_func_array ()	C:\workspace\mysite\includes\theme.inc:166
3	trigger_error ()	C:\workspace\mysite\includes\database.mysql.inc:120

Comments

dado’s picture

using latest version of CCK (just downloaded CVS version).

dado’s picture

Status: Active » Fixed

this seems to have gone away w/ latest version of CCK & drupal

dado’s picture

Status: Fixed » Active

scratch that. i am still getting the above problems.

In addition:

(1) When I try to switch a node reference type from Autocomplete Text Field to Select List, it initially says it succeded but when I go away then try to create content or come back it is set back to Autocomplete Text Field.
(2) when I try to "preview" I get the above error messages (see 1st post in this issue). When I try to "submit" I get the form again with no error or other messages, and the node has not been created.

JonBob’s picture

Priority: Normal » Critical
Michael Hofmockel’s picture

running drupal4.7, CCK (cvs as of 1May2006)

create new node type with "title and nodereference". OK
When create content new node preview - get error

* warning: Invalid argument supplied for foreach() in /htdocs/modules/node.module on line 359.
* warning: implode(): Bad arguments. in /htdocs/modules/node.module on line 363.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /htdocs/includes/database.mysql.inc on line 120.

The preview of the nodereference field is "<"

when create content new node submit - OK

JonBob’s picture

Status: Active » Fixed

Fixed.

asparagus’s picture

Status: Fixed » Active

i'm using 4.7 with the cvs version of cck, and am also getting this error on preview.

cck nodereference version: // $Id: nodereference.module,v 1.27 2006/05/05 14:10:44 JonBob Exp $

the error is:

warning: Invalid argument supplied for foreach() in /home/.blunder/ringo380/dev.bayouproperties.com/drupal47/modules/node.module on line 359.
warning: implode(): Bad arguments. in /home/.blunder/ringo380/dev.bayouproperties.com/drupal47/modules/node.module on line 363.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/.blunder/ringo380/dev.bayouproperties.com/drupal47/includes/database.mysql.inc on line 120.

lekei’s picture

This issue is still here. It may have been dropped because it had been reported as fixed at some point.

In my case I have a nodereference to an image node (it seems to be the only way to select an image) for a node.

The following 3 errors occur:

warning: Invalid argument supplied for foreach() in c:\www\drupal.all\modules\node.module on line 359.

warning: implode(): Bad arguments. in c:\www\drupal.all\modules\node.module on line 363.

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM qbprint_node n INNER JOIN qbprint_users u ON u.uid = n.uid INNER JOIN qbprint_node_revisions r ON r.vid = n.vid WHERE in c:\www\drupal.all\includes\database.mysql.inc on line 120.

lekei’s picture

Title: cck bug in nodereference: warnings when previewing (validating?) a cck node w/ nodereference field » More information:

This bug occurs ONLY for drop-down lists. If the edit type is auto-complete text box then it works fine.

Problem is that auto-complete requires the user to guess (could take up to 34 tries, all letters and numbers, to find what you are looking for).

marcoBauli’s picture

Title: More information: » cck bug in nodereference: warnings when previewing (validating?) a cck node w/ nodereference field

lekei,

submitting a Title when following up to issues cause the title of the whole issue to be changed!

;)

lekei’s picture

Title: cck bug in nodereference: warnings when previewing (validating?) a cck node w/ nodereference field » cck bug in nodereference: warnings when previewing (validating?) a cck node w/ nodereference field

oops. me bad. Sorry.

lekei’s picture

Version: 6.x-1.x-dev » 4.7.x-1.x-dev

I think I have found the problem, and it is wider spread:

In PREVIEW, the object is all wrong. All items which have a select have the select index in the array instead of the value.

This messes up walking the array. It also makes the preview not function. Here is section of the output when node-content-business_card.tpl.php (for the content type "business card") is set to:
print ("<div style='white-space: pre;'>".print_r($node)."</div>");

stdClass Object
(
    [nid] => 12
    [vid] => 12
    [uid] => 1
    [created] => 1152134365
    [changed] => 1152136646
    [type] => content-business_card
    [title] => Test Card
    [field_aproved] => Array
        (
            [key] => Array
                (
                    [view] => 
                )

        )

    [field_card_body] => Array
        (
            [nids] => 0
        )

    [field_card_type] => Array
        (
            [key] => 4
        )

    [field_quantity] => Array
        (
            [key] => 2
        )

and the same thing in normal node view:

    [field_aproved] => Array
        (
            [0] => Array
                (
                    [value] => 0
                    [view] => 0
                )

        )

    [field_card_body] => Array
        (
            [0] => Array
                (
                    [nid] => 10
                    [view] => <a href="/node/10">Chances Gaming Entertainment</a>
                )

        )

    [field_card_type] => Array
        (
            [0] => Array
                (
                    [value] => Great Canadian Gaming Corporation
                    [view] => Great Canadian Gaming Corporation
                )

        )

    [field_quantity] => Array
        (
            [0] => Array
                (
                    [value] => 500
                    [view] => 500
                )

        )


So the problem exists in all input types, if the input is a selection widget.

onepairofpants’s picture

So I am getting the same issue and when i change the field to autocomplete it is fine. Since it seems that lekei is right, is there a patch floating around anywhere? If not I can certainly deal with autocomplete. not ideal but not a big deal.

thx,
thom

gothmog’s picture

I also have this very same issue with the lastest cvs version (11/07/2006).
Using autocomplete is the only workaround.

robert.redl@easytouch.cc’s picture

If I try to use a nodereference field in a view as argument I get the following error if I try to view the result:

Interesting is the SQL part where it says: 'FROM node node LEFT JOIN' (two times 'node'???)

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(node.nid))) FROM node node LEFT JOIN node_data_field_firma nod query: pager_query SELECT count(DISTINCT(node_data_field_firma.field_firma_DISTINCT(node.nid))) FROM node node LEFT JOIN node_data_field_firma node_data_field_firma ON node.vid = node_data_field_firma.vid LEFT JOIN node_content_person node_data_field_phone ON node.vid = node_data_field_phone.vid LEFT JOIN node_data_field_email_company node_data_field_email_company ON node.vid = node_data_field_email_company.vid WHERE (node.type IN ('content-person')) in /home/httpd/vhosts/easytouch.at/httpsdocs/itil/includes/database.mysql.inc on line 120.

repe-1’s picture

I bet this has to do with PHP 5 and stdObject.

I was evaluating Subscriptions-module and got stdObject-error when I was trying to preview/view for example forum topics. After I changed array type reference to an object one for the line where an error occured, I got rid of the error, but then I had these same type SQL / Implode etd. errors you guys are describing in this thread. Maybe there is some compatibility mode for PHP 5 or something.

-repe

lekei’s picture

PHP 5 may create its own set of issues (it does with a lot of code), that is why I don't use it.

The example I gave used PHP 4.4.0 on the production server and 4.4.2 on the dev server.

vph’s picture

I have this exact problem with drupal 4.7.2

killes@www.drop.org’s picture

Status: Active » Fixed

vph: please open a new issue, this one is so polluted with unrelated stuff that it is hard to see what it is about. Marking fixed as the original patch was committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)