-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Moving array access for CAPTCHA _.isEmpty check #31636
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
Conversation
When upgrading to 2.3.6 from 2.3.5-p2, a new CAPTCHA zone "payment_processing_request" is added. If a customer has an existing session (from 2.3.5-p2 or prior), and tries to access checkout with their existing session data, checkout will fail to load because the check to see if captchaData[formId] exists is not a valid function call. _.isEmpty() only returns a boolean value, so it cannot be enumerated like an array. Array access syntax has been moved in to the check, rather than outside it.
Hi @MellenIO. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests 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. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento create issue |
@magento run Functional Tests CE, Functional Tests EE |
1 similar comment
@magento run Functional Tests CE, Functional Tests EE |
@ihor-sviziev It should be reproducible as I ran in to this error when upgrading a client. #30537 sounds similar but had a different bug compared to myself, but I wonder if this is just a change between 2.4.x and 2.3.x? |
Hi @ihor-sviziev, thank you for the review. |
@magento run Functional Tests EE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @MellenIO Could you clarify what issue should be fixed by PR?
When customer registers and login on frontend, payment_processing_request
is present in mage-cache-storage local
storage key on 2.4-develop
And there is not clear what issue is caused by typo in captchaData)[formId]
as JS not
operator turn undefined value of captchaData)[formId]
into true
Also issue #30537 is reproducible on PR branch
@magento run Functional Tests EE |
@engcom-Delta did you create the customer & visit checkout on a version without the fix introduced in MC-36200? If you create the customer & then try to checkout in a prior version, you should have the key missing in your cache storage. What version did you initially upgrade from/to?
If you don't have a key in your cache storage that Magento expects, the code will crash because |
@magento run Functional Tests EE |
1 similar comment
@magento run Functional Tests EE |
Hi @ihor-sviziev, thank you for the review. |
✔️ QA passed |
Note: Automation tests are passed |
Hi @MellenIO, thank you for your contribution! |
When upgrading to 2.3.6 from 2.3.5-p2, a new CAPTCHA zone "payment_processing_request" is added.
If a customer has an existing session (from 2.3.5-p2 or prior), and tries to access checkout with their existing session data, checkout will fail to load because the check to see if
captchaData[formId]
exists is not a valid function call._.isEmpty()
only returns a boolean value, so it cannot be enumerated like an array. Array access syntax has been moved in to the check, rather than outside it.Description (*)
This change allows a
_.isEmpty()
check in thedefaultCaptcha.js
file to complete successfully, resolving issues with the checkout failing to load or infinitely loading after upgrading.Related Pull Requests
N/A
Fixed Issues (if relevant)
N/A - no reported issue for this yet?
Manual testing scenarios (*)
captcha
key of themage-cache-storage
local storage key. There should not be an entry forpayment_processing_request
/checkout
route with the same session as before/checkout
againQuestions or comments
I'm not sure if an issue is needed for this PR, but happy to make one if one is needed. This will also need to be backported to 2.3.6.
Contribution checklist (*)
Resolved issues: