Closed (fixed)
Project:
Phone
Version:
6.x-2.7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2007 at 04:59 UTC
Updated:
12 Jun 2013 at 05:56 UTC
Jump to comment: Most recent file
I created a new content type called "phone numbers", then added a phone number field. Went to the create content page and selected "phone numbers", entered in the value 12051231234, and saved the page. When viewing the page the phone number shows as "1 --".
I tried various values for the number including "1-205-123-1234" and "205-123-1234" but I get the same output.
This is on a new drupal 5.2 install. I upgraded to 5.3 but same problem. Uninstalled then reinstalled the module also just to see.
Anybody know what the deal is?
Thanks,
Tim
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | phone_187224_ca_prefix_val.patch | 714 bytes | dboulet |
Comments
Comment #1
dboulet commentedI'm having the same problem with version 2.11. The Phone field works fine in 2 of my CCK nodetypes, but not in a third. For that particular nodetype, the phone numbers are saved in the database as "()-". For some reason the numbers are being stripped out.
Comment #2
dboulet commentedIt turns out that the problem was not with the content type, but with the number that I was entering. I was entering the number as '204-123-4567'.
The problem is that this number still validates, but does not work with the regex match in phone.ca.inc. The regex does not recognize a prefix that starts with a 1, and therefore $matches remains empty after preg_match() on line 57. That's why the phone number is saved as blank in the database.
A solution would be to change the form validation so that, if a value is entered with a prefix that starts with '1', it produces an error. Line 22 of phone.ca.inc would be changed from:
to:
Comment #3
dboulet commentedHere's a patch that fixes the validation for Canadian phone numbers, prefixes that start with the number 1 should not be allowed.
Comment #4
thierry_gd commentedTaken into account in 6.2.8 release