davideme/libphonenumber-for-PHP — pull request #15 by jarseneault (2013-03-08 22:47:42+00:00)
Title: Avoid unsetting US as supported region

The demo.php code, if run for a US phone number with a US region, fails with

Error type: 0. Missing or invalid default region.

, because of the following line in PhoneNumberUtil::init:

```php
unset($this->supportedRegions[array_search(self::REGION_CODE_FOR_NON_GEO_ENTITY, $this->supportedRegions)]);
```

The array_search returns false, which is coerced to 0 for the unset, which happens to correspond to the US region.

The attached commit prevents this behavior, but I'm not sure what you were trying to do here. My guess is that you were attempting to check against countryCallingCodeToRegionCodeMap instead of supportedRegions. If so, feel free to change. Thanks! Please let me know if I was misunderstanding something.