DrHyde / perl-modules-Number-Phone

Number::Phone and friends
24 stars 32 forks source link

Stub Countries Consider CC-only Number Valid #40

Closed theory closed 9 years ago

theory commented 9 years ago

This test fails:

--- a/t/42-libphonenumber.t
+++ b/t/42-libphonenumber.t
@@ -51,4 +51,7 @@ is($je->country_code(), 44, "$CLASS->new('$ukje')->country_code()");
 is($je->country(), 'JE', "$CLASS->new('$ukje')->country()");
 is($je->format(), '+44 1534 556291', "$CLASS->new('$ukje')->format()");

+# Country code only.
+is $CLASS->new('+7'), undef, 'Should get no object for +7';
+
 done_testing;

I really don't think "+7" should be considered a valid country. We have quite a few number records in our system like this, now:

+7
+56
+52
+62
+44
+66
+54
+36
+57
+45
+64
+32
+30
+46
+20
+63
+33
+86
+31
+44 1
+354
+386
+356
+231
+262
+358
+389
+229
+355
+375
+385
+211
+265
+995
+352
+350

I'm assuming there's a wayward ? in the validator regular expressions somewhere…

DrHyde commented 9 years ago

This seems to affect any country where google's data doesn't have all three of the types that I smoosh together into "special rate" - that is, shared code, premium rate, and UAN. It also affects "country" codes for which I don't have stub classes at all such as Inmarsat.

Fixed in 3.0009, which is on its way to the CPAN now.

theory commented 9 years ago

Thanks, @DrHyde.