Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Questionable regex

$
0
0

Replies: 0

Hi team!

Please see class-wc-gateway-braintree.php:1418—we have this regex:

$invalid_characters = preg_replace( '/[\d-().]/', '', $value )

At least under PHP 7.3, this seems to result in the following error:

preg_replace(): Compilation failed: invalid range in character class at offset 3

Possibly need to escape the dash so it doesn’t look like a range:

$invalid_characters = preg_replace( '/[\d\-().]/', '', $value )


Viewing all articles
Browse latest Browse all 59525

Trending Articles