WebsiteBaker Community Forum
WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: sky writer on January 21, 2016, 06:43:54 AM
-
Bakery ver 1.76 does not accept 555-555-5555 as a valid phone number. This is standard North American formatting.
I notice there is a new forward slash added to the preg_match code on ~line 139 of save_form.php
if (!preg_match('#^[0-9)(xX +.-/]{7,20}$#', $value)) {
if (!preg_match('#^[0-9)(xX +.-/]{7,20}$#', $value)) {
The slash was not present in bakery ver 1.72 save_form.php
if (!preg_match('#^[0-9)(xX +.-]{7,20}$#', $value)) {
This accepts 555-555-5555 formatting.
Is there an intended purpose for the added slash?
-
Hi sky writer
It is a bug. Hyphens (-) inside of a regexp character class definition should be escaped else they are used as a meta-character.
The forward slash was added to the pattern in v1.7.6 to comply with some European phone number formats, eg. 089 / 123 45 67.
save_form.php about line 139:
if (!preg_match('#^[0-9)(xX +./\-]{7,20}$#', $value)) {
Thanks for the hint! I will fix it in all regexp patterns of the address form validation.
Regards Christoph