I get these errors when using Google Checkout. The other payment methods are fine.

Illegal offset type in xxx/sites/all/modules/ubercart/uc_cart/uc_cart.module on line 1369.
(same error for lines 1368, 1337, 1334)

Invalid argument supplied for foreach() in xxx/sites/all/modules/ubercart/uc_cart/uc_cart.module on line 1588.

A peek at the code identifies $items and its element $items[cid] as the common problem.

The first error on the list (maybe the first error thrown, but who knows?) is at line 1369, and that is in function uc_cart_get_contents. All the offset type errors are in that module. My suspicion is that when we go to Google Checkout, the cart contents have not yet been properly grabbed.

According to the log, my transactions ARE being processed, and I see them in Google Checkout (albeit without order details), so I'm not losing money, but this does seem to be a bug. If it's been fixed in 2.0, that's great, as I plan to install it with patches next week, but in the meantime, I have shut down GC out of caution.

CommentFileSizeAuthor
#3 ubercart.patch1.81 KBrolodmonkey

Comments

chazz’s picture

Version: 6.x-2.0-rc7 » 6.x-2.2

Same story here with 6x.2.2 , I noticed errors in recent log entry section:

	php	03/31/2010 - 12:30	Duplicate entry '16' for key ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in isset or empty in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in unset in ...	Customer	
	php	03/31/2010 - 12:30	Invalid argument supplied for foreach() in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:30	Illegal offset type in isset or empty in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in isset or empty in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in unset in ...	Customer	
	php	03/31/2010 - 12:29	Invalid argument supplied for foreach() in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in ...	Customer	
	php	03/31/2010 - 12:29	Illegal offset type in isset or empty in ...	Customer	

Payment received fine, but I don't know if customer can see this errors as well

rolodmonkey’s picture

I am getting the same behavior. In version 6.x-2.2, the line for the first error has changed to 1337 in uc_cart.module.


function uc_cart_get_contents($cid = NULL, $action = NULL) {
  static $items = array();
  $cid = $cid ? $cid : uc_cart_get_id();

  if ($action == 'rebuild') {
    unset($items[$cid]);
  }

  if (!isset($items[$cid])) { // <------ right here

This is definitely happening when a customer makes it over to Google Checkout but I'm not sure it is directly related to that module. Another clue is that I got a blank email after the customer finished checking out.

I am going through the code and trying to backtrack through all of the places that uc_cart_get_contents() is called, but I really hope that someone else might already have a good idea about where this is happening.

rolodmonkey’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new1.81 KB

Okay, I found the problem.

I have to admit that I'm a little frustrated because it turned out to be the same problem that I tracked down last year:

http://www.ubercart.org/comment/42099

This time, I have gone as far as to create a patch of my fixes. I would really appreciate it if someone could get this patch into the next release.

rolodmonkey’s picture

Status: Patch (to be ported) » Needs review
chazz’s picture

Thanks! Applied the path, will see if it's work when I'll get an order.

Is it possible to test it somehow?

rolodmonkey’s picture

You should set up a Google sandbox account for testing purposes. Then, you should switch to test mode in the Ubercart Google Checkout settings and put in the Merchant ID and Key for the sandbox. That way you can run as many tests as you need without creating any real transactions.

chazz’s picture

Just received new order via Google Checkout today, but I can't see ANY action in log files. User account has been created, stock has been decreased, google checkout is marked as paid (also on ubercart) but there is none information in website admin recent log file. It should be at least note about new user account or new order.

So looks like path nr. 3 is working so far, no error after update, thanks!

thill_’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
Priority: Normal » Critical

This needs a bump and a review as it is still an issue in the current dev version.

thill_’s picture

Status: Needs review » Reviewed & tested by the community

This corrects issues with current dev and google API 2.4.

tr’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.