mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🔒️ Add array sanitizer for products field
This commit is contained in:
parent
4102ba285b
commit
37beb591d5
2 changed files with 3 additions and 1 deletions
|
@ -98,6 +98,8 @@ class OnboardingRestEndpoint extends RestEndpoint {
|
|||
*/
|
||||
public function __construct( OnboardingProfile $profile ) {
|
||||
$this->profile = $profile;
|
||||
|
||||
$this->field_map['products']['sanitize'] = fn( $list ) => array_map( 'sanitize_text_field', $list );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,7 @@ class RestEndpoint extends WC_REST_Controller {
|
|||
|
||||
if ( null === $sanitation_cb ) {
|
||||
$sanitized[ $key ] = $value;
|
||||
} elseif ( method_exists( $this, $sanitation_cb ) ) {
|
||||
} elseif ( is_string( $sanitation_cb ) && method_exists( $this, $sanitation_cb ) ) {
|
||||
$sanitized[ $key ] = $this->{$sanitation_cb}( $value );
|
||||
} elseif ( is_callable( $sanitation_cb ) ) {
|
||||
$sanitized[ $key ] = $sanitation_cb( $value );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue