foreach() error after removing product from cart and loging out and back in

Posts: 29
Joined: 11/05/2007

Hello,

I continue to narrow down this problem using the devel module and backtrace. To reproduce the problem I do the following:

1) login
2) add a product to my cart
3) remove the product from my cart
4) logout
5) login

This is the a portion of the backtrace I received

These calls

uc_cart_user UPDATE white_uc_cart_products SET cart_id = 1 WHERE cart_id = '9bdmnrvk4k8glk78j68ppm0nd5'

uc_cart_get_contents SELECT c.*, n.title, n.vid FROM white_node n INNER JOIN white_uc_cart_products c ON n.nid = c.nid WHERE c.cart_id = '1'

taxonomy_node_get_terms_by_vocabulary SELECT t.tid, t.* FROM white_term_data t INNER JOIN white_term_node r ON r.tid = t.tid WHERE t.vid = 2 AND r.nid = 13 ORDER BY weight

uc_cart_user DELETE FROM white_uc_cart_products WHERE cart_id = 1

produce these errors (Notice the strange cart_id in the first call. The backtrace shows where c.cart_id is set but not cart_id) Could this be a typo?

warning: Invalid argument supplied for foreach() in /var/www/users/rustridge/drupal/modules/node/node.module on line 521.
warning: implode() [function.implode]: Bad arguments. in /var/www/users/rustridge/drupal/modules/node/node.module on line 525.

with these calls to watchdog

watchdog INSERT INTO white_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', 'Invalid argument supplied for foreach() in /var/www/users/rustridge/drupal/modules/node/node.module on line 521.', 2, '', 'http://www.racehorsewhite.com/user/login?destination=node', 'http://www.racehorsewhite.com/', '64.81.145.219', 1194545822)

watchdog INSERT INTO white_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', 'implode() [function.implode]: Bad arguments. in /var/www/users/rustridge/drupal/modules/node/node.module on line 525.', 2, '', 'http://www.racehorsewhite.com/user/login?destination=node', 'http://www.racehorsewhite.com/', '64.81.145.219', 1194545822)

This call

node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, 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 white_node n INNER JOIN white_users u ON u.uid = n.uid INNER JOIN white_node_revisions r ON r.vid = n.vid WHERE

produces this error message (Notice the missing n.nid = "some value" after the WHERE clause on the select statement above.)

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: node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, 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 white_node n INNER JOIN white_users u ON u.uid = n.uid INNER JOIN white_node_revisions r ON r.vid = n.vid WHERE in /var/www/users/rustridge/drupal/includes/database.mysql.inc on line 172

with this call to watchdog

watchdog INSERT INTO white_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', '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\nquery: node_load\nSELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, 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 white_node n INNER JOIN white_users u ON u.uid = n.uid INNER JOIN white_node_revisions r ON r.vid = n.vid WHERE in /var/www/users/rustridge/drupal/includes/database.mysql.inc on line 172.', 2, '', 'http://www.racehorsewhite.com/user/login?destination=node', 'http://www.racehorsewhite.com/', '64.81.145.219', 1194545822)

and these calls

drupal_lookup_path SELECT dst FROM white_url_alias WHERE src = 'erp/stock/cart_confirm'

uc_product_forms SELECT nid FROM white_uc_products

uc_product_kit_forms SELECT DISTINCT nid FROM white_uc_product_kits

produce this error

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'stock_add_to_cart' was given in /var/www/users/rustridge/drupal/includes/form.inc on line 217.

with this call to watchdog

watchdog INSERT INTO white_watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', 'call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'stock_add_to_cart' was given in /var/www/users/rustridge/drupal/includes/form.inc on line 217.', 2, '', 'http://www.racehorsewhite.com/user/login?destination=node', 'http://www.racehorsewhite.com/', '64.81.145.219', 1194545822)

Since the product was removed from the cart before logout I would think the cart should be empty upon loging in again. Even if it is not I don't think this is being handled properly.

Much thanks to the developers of the devel package!

Any help in solving this would be appreciated.

Thanks

Posts: 4747
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

It looks to me like either some custom erp module you have or some other stock module may be causing some of these errors. Have you tried disabling these modules and trying the sequence?