floere / phony

E164 international phone number normalizing, splitting, formatting.
http://florianhanke.com/phony/
MIT License
1.01k stars 226 forks source link

Phony.plausible? returns true for non-plausible German number #526

Open ademdinarevic opened 2 months ago

ademdinarevic commented 2 months ago

Important fact: Phony only works with international phone numbers. It needs the country code to be able to identify the number's country and rules.

What I did

For any number other than German, when adding two country codes to the number, the Phony.plausible? check returns true

What happened

For number `"+49+491505632832", Phony.plausible? returns true

What I expected to happen and why

I would expect to return false, like it does for other country codes

floere commented 1 month ago

@ademdinarevic Hi! Thanks for the issue – would you want to try improving this and open a PR? I think it succeeds/fails because of the length. It should probably check if the number is in a general good state and perhaps raise in a case like this, so the user of the gem can fix their code.