Skip to content

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

Merged
merged 3 commits into from
Oct 25, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/code/Magento/Braintree/Controller/Paypal/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@ public function execute()
}

/**
* @param array $requestData
* @return boolean
* @param $requestData
* @return bool
*/
private function validateRequestData(array $requestData)
private function validateRequestData($requestData)
Copy link
Contributor

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)

Copy link
Contributor

@rogyar rogyar Oct 15, 2018

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.

{
return !empty($requestData['nonce']) && !empty($requestData['details']);
if (is_array($requestData)) {
return !empty($requestData['nonce']) && !empty($requestData['details']);
}
return false;
}
}