Closed (fixed)
Project:
Constant Contact
Version:
6.x-2.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
22 Feb 2011 at 19:53 UTC
Updated:
14 May 2011 at 20:01 UTC
After processing an order in Ubercart, when hook_checkout_complete() fires, if the uc_roles module is invoked for role based products, a PHP error is produced in constant_contact.module, line 581:
<?php
if($category == 'account'):
$lists = $edit['cc_newsletter_lists'];
else:
$lists = $account->cc_newsletter_lists;
endif;
$newlists = array();
foreach($lists as $list_id => $enabled):
if(intval($enabled) !== 0):
$list = $cc->get_list($list_id);
$newlists[$list_id] = $list['Name'];
endif;
endforeach;
?>
Running a debug_backtrace showed that when uc_roles implements user_save(), the constant_contact.module's hook_user doesn't pickup on the fact that there's no $edit['cc_newsletters_lists'] and tries passing NULL through the foreach.
A previous bug fix for a similar problem @ line 353 (http://drupal.org/node/697400) doesn't catch this.
Changing @ line 354:
<?php
if($op == 'insert' || $op == 'after_update'):
if(!isset($edit['cc_newsletter']) && !isset($account->cc_newsletter) && !count($edit['cc_newsletter_lists']) && !count($account->cc_newsletter_lists)):
return;
endif;
endif;
?>To:
<?php
if($op == 'insert' || $op == 'after_update'):
if ($category == 'account' && !isset($edit['cc_newsletter_lists'])) {
return;
}
if(!isset($edit['cc_newsletter']) && !isset($account->cc_newsletter) && !count($edit['cc_newsletter_lists']) && !count($account->cc_newsletter_lists)):
return;
endif;
endif;
?>
worked for me.
Attached is a patch makes this change, but it needs additional testing to check for other conflicts.
Hope it helps!
| Comment | File | Size | Author |
|---|---|---|---|
| constant_contact.module.patch | 562 bytes | r.aubin |
Comments
Comment #1
justphp commentedComment #2
justphp commentedFixed it beta2 (releasing in a moment)