-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Braintree Paypal Review: check if variable is array when validating request data #18614
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
Braintree Paypal Review: check if variable is array when validating request data #18614
Conversation
Hi @deninchoo. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@deninchoo thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
*/ | ||
private function validateRequestData(array $requestData) | ||
private function validateRequestData($requestData) |
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.
Instead of changing this function, please fix a place where it is called
does not get declared as an array as the requested post value returns a null, causing the validateRequestData($requestData)
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.
Not sure it's the best way to go. It's a private method and its purpose is to validate the request data. So, checking the type might be a part of the validation. It looks like an overhead to create an additional validation alongside with the method-validator.
… validating request data #18614
Hi @deninchoo. Thank you for your contribution. |
Description (*)
In some cases when the Magento/Braintree/Paypal/Review.php class gets executed, the
$requestData = json_decode( $this->getRequest()->getPostValue('result', '{}'), true );
does not get declared as an array as the requested post value returns anull
, causing thevalidateRequestData($requestData)
function call to produce theTypeError: Uncaught exception
as the function expects the passed variable$requestData
to be an array.This pull request introduces changes that ensure there are no exceptions when a
null
value is passed to thevalidateRequestData($requestData)
function.Fixed Issues (if relevant)
Manual testing scenarios (*)
Contribution checklist (*)