mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix Psalm error
This commit is contained in:
parent
55f3ff9d3b
commit
e84bc21044
1 changed files with 16 additions and 3 deletions
|
@ -85,9 +85,9 @@ class GatewayRedirectService {
|
||||||
|
|
||||||
// Get current URL parameters.
|
// Get current URL parameters.
|
||||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||||
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
$page = isset( $_GET['page'] ) ? $this->sanitize_get_param( $_GET['page'] ) : '';
|
||||||
$tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
|
$tab = isset( $_GET['tab'] ) ? $this->sanitize_get_param( $_GET['tab'] ) : '';
|
||||||
$section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : '';
|
$section = isset( $_GET['section'] ) ? $this->sanitize_get_param( $_GET['section'] ) : '';
|
||||||
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||||
|
|
||||||
// Check if we're on a WooCommerce settings page and checkout tab.
|
// Check if we're on a WooCommerce settings page and checkout tab.
|
||||||
|
@ -108,4 +108,17 @@ class GatewayRedirectService {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitizes a GET parameter that could be string or array.
|
||||||
|
*
|
||||||
|
* @param mixed $param The parameter to sanitize.
|
||||||
|
* @return string The sanitized parameter.
|
||||||
|
*/
|
||||||
|
private function sanitize_get_param( $param ): string {
|
||||||
|
if ( is_array( $param ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return sanitize_text_field( wp_unslash( $param ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue