mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
sanitize checkout form data differently than usual input data as it is url encoded, do not use wp_parse_args as it has sideeffects.
This commit is contained in:
parent
644194859f
commit
67eb9aa06b
2 changed files with 24 additions and 6 deletions
|
@ -256,10 +256,20 @@ class CreateOrderEndpoint implements EndpointInterface {
|
|||
* @throws \Exception On Error.
|
||||
*/
|
||||
private function validate_checkout_form( string $form_values, Order $order ) {
|
||||
$this->order = $order;
|
||||
$parsed_values = wp_parse_args( $form_values );
|
||||
$_POST = $parsed_values;
|
||||
$_REQUEST = $parsed_values;
|
||||
$this->order = $order;
|
||||
$form_values = explode( '&', $form_values );
|
||||
|
||||
$parsed_values = array();
|
||||
foreach ( $form_values as $field ) {
|
||||
$field = explode( '=', $field );
|
||||
|
||||
if ( count( $field ) !== 2 ) {
|
||||
continue;
|
||||
}
|
||||
$parsed_values[ $field[0] ] = $field[1];
|
||||
}
|
||||
$_POST = $parsed_values;
|
||||
$_REQUEST = $parsed_values;
|
||||
|
||||
add_filter(
|
||||
'woocommerce_after_checkout_validation',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue