Skip to content
This repository has been archived by the owner on Aug 21, 2018. It is now read-only.

Call to a member function hasLeadingDigits() on a non-object for US-numbers #1

Open
burki opened this issue Apr 30, 2012 · 1 comment

Comments

@burki
Copy link

burki commented Apr 30, 2012

Hi

In the function private function getRegionCodeForNumberFromRegionList in PhoneNumberUtil.php
$metadata = $this->getMetadataForRegion($regionCode);
returns null for $regionCode = 'US';

Changing the code in
private function init($filePrefix) {
to
$idx_region_code_non_geo_entity = array_search(self::REGION_CODE_FOR_NON_GEO_ENTITY, $this->supportedRegions);
if (FALSE !== $idx_region_code_non_geo_entity)
unset($this->supportedRegions[array_search(self::REGION_CODE_FOR_NON_GEO_ENTITY, $this->supportedRegions)]);

to avoid removing US from $this->supportedRegions in case of a failed array_search for self::REGION_CODE_FOR_NON_GEO_ENTITY solved it for me

ajayrungta pushed a commit to ajayrungta/libphonenumber-for-PHP that referenced this issue May 25, 2012
Mobile pattern update to match 8551###### as valid indian mobile number
@rantebi
Copy link

rantebi commented Feb 21, 2013

@burki, I have the same issue and I don't understand what you did to fix it (maybe it's because the function has changed from 10 months ago).
Could it be that this library doesn't support any US numbers at the moment??
Sorry if I'm too newb.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants