OpenVBX-Plugin-Subscriptions icon indicating copy to clipboard operation
OpenVBX-Plugin-Subscriptions copied to clipboard

Latest subscriptions.php preg_match is flawed

Open dasilvatek opened this issue 13 years ago • 2 comments

Using the latest version, adding multiple US numbers to a subscription list fails - or I should say: does not function right. Please try adding 2 CSV numbers via the web interface - you will see that it creates 1 international number out of the string.

I fixed this myself locally by adding a comma in the preg_match code in subscriptions.php, line 44:

preg_replace('/[^0-9\n,]+/'

dasilvatek avatar Aug 01 '12 00:08 dasilvatek

Numbers have to be on separate lines rather than separated by commas. That was the only way I could get it to support international numbers too.

chadsmith avatar Aug 01 '12 00:08 chadsmith

My suggested solution works well for all numbers as you had intended, and accepts comma separated in addition to one number per line. Anyone looking to add the old space-delimiter can adjust by adding a space after the comma, as follows:

preg_replace('/[^0-9\n, ]+/'

This solution is working well for me for all numbers and common delimiters my customers require.

dasilvatek avatar Aug 01 '12 00:08 dasilvatek