mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
✨ Strip forbidden chars from soft descriptor
This commit is contained in:
parent
5ea95cbf44
commit
5256f625bd
1 changed files with 3 additions and 6 deletions
|
@ -329,12 +329,9 @@ class PurchaseUnitFactory {
|
|||
* @return string The sanitized soft descriptor.
|
||||
*/
|
||||
private function sanitize_soft_descriptor( string $soft_descriptor ) : string {
|
||||
$decoded = html_entity_decode(
|
||||
$soft_descriptor,
|
||||
ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE,
|
||||
'UTF-8'
|
||||
);
|
||||
$decoded = html_entity_decode( $soft_descriptor, ENT_QUOTES, 'UTF-8' );
|
||||
$sanitized = preg_replace( '/[^a-zA-Z0-9 *\-.]/', '', $decoded ) ?: '';
|
||||
|
||||
return substr( $decoded, 0, 22 ) ?: '';
|
||||
return substr( $sanitized, 0, 22 ) ?: '';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue