-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matching of prefix-less UK numbers to Jersey #101
Comments
|
Well this is definitely a bug - if you've asked for country XX then you ought to get country XX or nothing, not some related guesstimate! |
|
I believe I have a fix in 08c0c27. Unless problems show up in testing that will be in the next release. It will still return an object if you ask for |
|
And all the CI tests passed. I'll close this ticket shortly unless you have any comments. |
|
Looks good, thanks :-) |
|
Couple of additional thoughts only just come to me, sorry:
It was really only the fact it supported "402609" on its own that was my issue, not that it worked within the same numbering plan. If my code uses I can't currently switch to "+44" as a first argument because of point 1, it will say 402609 is valid again. I guess if that was resolved, I could then switch to +44 as my first argument instead of GB and that would work. |
|
The first of those is unfortunate, but it's a limitation of the libphonenumber data. I could hard-code information about the UK numbering plan in there, but that's really icky. The second ... hmmm. I'm not sure what is correct there. I think I'm less unhappy with the current behaviour, but I agree it's a nasty mess. Unfortunately I can't just get rid of the nationalPrefixTransformRule completely, as it really is required for some other countries. Do you think it would be acceptable to drop it for GG/IM/JE only? |
|
I've pushed c34782d which I think improves things. It's still a bit confusing though, so in particular please let me know any ways I can improve the doco. |
|
I think that makes sense, thanks! Documentation explains it as I understand it too. |
There is an issue with Number::Phone that means it is matching e.g. 402609 as a Jersey phone number. Reported and behaviour improved at DrHyde/perl-modules-Number-Phone#101, but until a new release, move the searches around so a ref search takes precedence.
There is an issue with Number::Phone that means it is matching e.g. 402609 as a Jersey phone number. Reported and behaviour improved at DrHyde/perl-modules-Number-Phone#101, but until a new release, move the searches around so a ref search takes precedence.
|
version 3.8000 with this fix in is now on its way to your friendly local CPAN mirror |
I was not expecting the following:
What appears to be happening is that Number::Phone::Lib calls _new_args, which calls phone2country with
+44406092. The idd code checking matches on44 => ['GB', 'GG', 'IM', 'JE']line, and the number is passed to each StubCountry in turn. All except GB have a nationalPrefixTransformRule check (created by build-data.stubs atperl-modules-Number-Phone/build-data.stubs
Line 157 in 62210a8
[25-9], IM[5-8]and JE[0-24-8]- the last of these passes and so it comes back as a valid Jersey number. Which I mean, I guess it is, but it wasn't really what I was going for, if that's the case it's also a valid GB number in various places :)Not sure if there's an easy solution, or if I've missed something obvious. I generally want to assume a full UK phone number including area code has been given.
The text was updated successfully, but these errors were encountered: