Fix psalm

This commit is contained in:
dinamiko 2022-06-23 11:50:08 +02:00
parent 035ff32d59
commit 2b4f77818b
2 changed files with 5 additions and 3 deletions

View file

@ -347,8 +347,11 @@ class PayUponInvoice {
}
$national_number = filter_input( INPUT_POST, 'billing_phone', FILTER_SANITIZE_STRING );
if ( $national_number && ! preg_match( '/^[0-9]{1,14}?$/', preg_replace( '/[^0-9]/', '', $national_number ) ) ) {
$errors->add( 'validation', __( 'Phone number size must be between 1 and 14', 'woocommerce-paypal-payments' ) );
if ( $national_number ) {
$numeric_phone_number = preg_replace( '/[^0-9]/', '', $national_number );
if ( $numeric_phone_number && ! preg_match( '/^[0-9]{1,14}?$/', $numeric_phone_number ) ) {
$errors->add( 'validation', __( 'Phone number size must be between 1 and 14', 'woocommerce-paypal-payments' ) );
}
}
},
10,

View file

@ -256,7 +256,6 @@ class WCGatewayModule implements ModuleInterface {
$logger->error( $message );
$wc_order->update_status( 'failed', $message );
}
},
10,
2