Closed martynas-al closed 3 years ago
Hi @martynas-al. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, please, review the Magento Contributor Assistant documentation.
Please, add a comment to assign the issue: @magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!
Hello,
I reopen this issue as I bump into this earlier.
To add a bit explanations just look at :
public function toFlatArray(
ExtensibleDataInterface $dataObject,
$skipCustomAttributes = [],
$dataObjectType = null
) {
$dataObjectArray = $this->toNestedArray($dataObject, $skipCustomAttributes, $dataObjectType);
return ConvertArray::toFlatArray($dataObjectArray);
}
in magento/framework/Api/ExtensibleDataObjectConverter.php
Having the same attribute name as customer one in your extension attribute will result in your extension attribute overriding customer one.
Example :
{
"id": "172",
"extension_attributes": {
"posts": [
{
"id": "187",
"desc": "test"
}
]
}
}
Will give the customer with the wrong ID, 187 in this case.
I think that the "ConvertArray::toFlatArray" method must skip extension attributes in its transform process.
Can we have any help on this?
Thanks you
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
I did some digging around and basically figured out why this happens. Magento calls
Magento\Quote\Model\ChangeQuoteControl::isAllowed
before quote is saved and performs a check to see ifcustomer_id
in quote and in user's context match and it doesn't if customer added new shipping address which needs to be saved.The
customer_id
doesn't match because a couple of steps beforeMagento\Quote\Model\Quote::setCustomer
is called. In this method customer object is beeing flattened and the flattened values are set as quote values. While customer flattening happens,Magento\Framework\Convert\ConvertArray::toFlatArray
is called and this is where the issue happens. If your customer object has extension attributes which haveid
field in them, then after flattening customer object's id becomes the id value of the last processed extension attribute's ID. Basically, because of recursive callsarray_merge
overrides previously set values.Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.