Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.3-p1 - Magento\Customer\Model\Address\AbstractAddress::_implodeArrayValues($value) #35160

Closed
1 task done
zepgram opened this issue Mar 3, 2022 · 10 comments · Fixed by #35658
Closed
1 task done
Assignees
Labels
Area: Shipping Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Project: GraphQL Reported on 2.4.3-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@zepgram
Copy link

zepgram commented Mar 3, 2022

Preconditions (*)

  1. Magento 2.4.3-p1
  2. PHP 7.4

Steps to reproduce (*)

  1. To reproduce, simply try to set an address through graphql with a non scalar attribute (null) for second street.

    image
mutation {
 setShippingAddressesOnCart(
  input: {
   cart_id: "{{cart}}"
   shipping_addresses: [
    {
     address: {
      country_code: "FR"
      street: ["Lorem ipsum dolor sit ame", null]
      telephone: "0601020304"
      postcode: "56590"
      city: "PARIS"
      firstname: "B"
      lastname: "C"
      save_in_address_book: false
     }
    }
   ]
  }
 ) {
  cart {
   shipping_addresses {
    firstname
    lastname
    company
    street
    city
    postcode
    country {
     code
     label
    }
    telephone
   }
  }
 }
}

Expected result (*)

  1. While analysing this issue, I found out that magento/vendor/magento/module-customer/Model/Address/AbstractAddress.php is responsible of this.
  2. Left side is 2.4.3-p1, right side is 2.3.5, by simply reading the code you can understand the issue: if one of the value in the array is non-scalar, values will never be trimmed and exploded as expected. see related commit: 876c805

    image
  3. By putting back the 2.3.5 code, this work as expected:

    image

Actual result (*)

  1. By setting null in secondary address field, an exception is thrown: "The address failed to save. Verify the address and try again."

    image
  2. Due to the scalar condition, the street field is never imploded and his value is an array instead of a string, the class magento/framework/DB/Adapter/Pdo/Mysql.php logicly throw when trying to cast the value in string, and we can find this in logs: [2022-03-03 09:42:03] report.CRITICAL: Notice: Array to string conversion in /home/bcalef/src/zv/ecom/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3170 {"exception":"[object] (Exception(code: 0): Notice: Array to string conversion in /home/bcalef/src/zv/ecom/magento/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3170 at /home/bcalef/src/zv/ecom/magento/vendor/magento/framework/App/ErrorHandler.php:61)"} []

Due to multiple impact and side effects on quote/customer addresses, I think this is a S0 priority.

  • Severity: S0
@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2022

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Verified the issue on Magento 2.4-develop branch and the issue is reproducible:
image

@engcom-November engcom-November added Area: Shipping Component: GraphQL GraphQL Reported on 2.4.3-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Project: GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Mar 3, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Mar 3, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-2556 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2022

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@sdzhepa sdzhepa added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Mar 10, 2022
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Mar 10, 2022
@Zaahed
Copy link
Contributor

Zaahed commented Jun 14, 2022

@magento I'm working on this

@pmzandbergen
Copy link
Contributor

pmzandbergen commented Aug 8, 2022

Confirmed on 2.4.4, applying patch for magento/module-customer on our projects awaiting a fix in the Magento Core.

See PR above from @Zaahed for patch

@pmzandbergen
Copy link
Contributor

@Zaahed accidentally didn't spot your PR, which does the job (even with only null values). Maybe add a unit test to verify and keep future updates from breaking this again.

@Zaahed
Copy link
Contributor

Zaahed commented Aug 8, 2022

@pmzandbergen Thx for the suggestion. I added a unit test to the PR.

@PascalBrouwers
Copy link
Contributor

I can confirm this issue is present in 2.4.3 when using GraphQL. Using provided diff I can also confirm it works when reverting the code.

Currently it's almost a year later and still not fixed or even added to the latest develop branch.

@engcom-November
Copy link
Contributor

Hi @zepgram ,
Development team has started working on this issue.
Thank you.

@github-jira-sync-bot github-jira-sync-bot added Progress: ready for grooming Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: ready for grooming labels Mar 31, 2023
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Done in High Priority Backlog May 3, 2023
@m2-community-project m2-community-project bot added Progress: done and removed Progress: PR Created Indicates that Pull Request has been created to fix issue Progress: PR in progress labels May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Shipping Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Project: GraphQL Reported on 2.4.3-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

Successfully merging a pull request may close this issue.

7 participants