When an user without (default) addresses in the address book tries to checkout, two 'empty' objects are assigned to the $order->uc_addresses array, while it should have been two UcAddressesAddress instances.
While this previously didn't lead to direct problems, it now does with this change in the latest commit:
}
$address = uc_addresses_new_address_from_order($order, $order_address_type);
}
+ $address->address_type = $address_type;
$order->uc_addresses[$address_type] = $address;
}
break;
@@ -855,6 +856,7 @@ function uc_addresses_uc_order($op, &$order, $arg2) {
// Construct new address.
$address = uc_addresses_new_address_from_order($order, $order_address_type);
}
+ $address->address_type = $address_type;
$order->uc_addresses[$address_type] = $address;
}
break;
This can result into the Call to undefined method stdClass::getField() when an user without addresses enters checkout. It also broke a part of the checkout test.
I'm working on a fix.
Comments
Comment #1
megachrizThe attached patch should fix the issue: a check is done if $address exists before it's assigned to the order. If it doesn't contain anything, a new address instance is created. The checkout test is also adjusted a little to prevent a fatal error.
Comment #3
megachrizO.K. Using a patch to check if it fixes a branch test is not possible, because patches are not tested by the testbot when the branch tests are failing.
I have executed all tests locally now to see if the changes in the patch #1 fixed the checkout test. After doing so, it appeared the patch introduced an other bug which cause the checkout to fail again. With another small change, all tests finally passed.
A fix has been committed. (Of course, applying the patch in #1 will fail now that the coding changes it introduced are already committted.)