WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 R24 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Is not a valid phone number
  • Print
Pages: [1]   Go Down

Author Topic: Is not a valid phone number  (Read 4843 times)

Offline sky writer

  • Posts: 926
Is not a valid phone number
« 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)) {
Code: [Select]
if (!preg_match('#^[0-9)(xX +.-/]{7,20}$#', $value)) {
The slash was not present in bakery ver 1.72 save_form.php
Code: [Select]
if (!preg_match('#^[0-9)(xX +.-]{7,20}$#', $value)) {This accepts 555-555-5555 formatting.

Is there an intended purpose for the added slash?
Logged

freeSbee

  • Guest
Re: Is not a valid phone number
« Reply #1 on: January 21, 2016, 11:40:44 AM »
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:
Code: [Select]
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
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Bakery Shop »
  • Is not a valid phone number
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2