Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.5

Bug #16909 Phone number validation
Submitted: 2009-12-16 03:48 UTC
From: jausions Assigned:
Status: Open Package: Validate_US (version 0.5.3)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2009-12-16 03:48 UTC] jausions (Philippe Jausions)
Description: ------------ Bug #16907 raised an issue with phone number validation in Validate_CA package. Same applies to Validate_US. I fixed the Validate_CA::phoneNumber() method and expanded the test suite for that package. Please backport to Validate_US package. Since this method is dealing with NANPA shared by multiple countries, it may be useful to spin it in a shared file... or at least keep that in mind.

Comments

 [2010-01-03 01:13 UTC] rarpsl (Robert Rosenberg)
To be fully compatible with the international phone number layout the 1 country code for US/CA should be +1. Add a [\+]? before the test for the optional 0/1. Note that 1 AC EXCH NUM is valid although it would be entered as +1 AC EXCH NUM (parens and dashes optional) if following the International Phone Number Layout rules (thus the optional test for the +). Note that for full compliance with the international rules only a space separates the sections so the current code works except for the initial +. I have found that a inital ltrim() before the call to phonenumber() helps to insure that the first actual character of the parameter is checked correctly.