Closed ihor-sviziev closed 9 years ago
@ihor-sviziev, thank you posting this issue, but could you provide a way how we can get this fatal? Do you use native Magento workflows? Or is it a result of some customizations?
@vpelipenko I got this issue in my own module, it contains cloning of customer model, which firing this method.
@ihor-sviziev, how can we reproduce this issue? What should we do for that?
@vpelipenko use code like this:
//Customer ID which has selected shipping address and NOT selected billing address
$customerId = '1';
$customer = $this->_objectManager->create('Magento\Customer\Model\Customer');
$customer->load($customerId);
//This part will cause fatal error
$primaryAddresses = $customer->getPrimaryAddresses();
//This part also will cause fatal error
$newCustomer = clone $customer;
Ok. Thanks. We will try to check it.
Issue is closed, because PR #1097 is created instead.
Once you have customer model with primary shipping, but wo primary billing and try to execute getPrimaryAddresses method - you got fatal error. It's happening because there no checking that you have primary billing. https://github.com/magento/magento2/blob/develop/app/code/Magento/Customer/Model/Customer.php#L722
This issue also exists in Magento CE 1.9.1.
How to fix it: