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

PhoneNumberUtil.php fails to recognize extensions #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Nephele
Copy link

@Nephele Nephele commented Feb 26, 2013

If PhoneNumberUtil is asked to parse a number containing an extension, it fails to recognize the extension for nearly all extension formats ('x', 'ext.', '#', etc.).

The problem is that the initialization functions in getInstance() are called in the wrong order. self::initCapturingExtnDigits() needs to be called before self::initExtnPatterns(). Otherwise the extension patterns are created using a blank value for self::$CAPTURING_EXTN_DIGITS, i.e., the part of the pattern that is supposed to match the extension number is missing.

One of the attached commits fixes this issue. The other commit incorporates several bug fixes previously posted by resscode.

@Nephele Nephele closed this Feb 26, 2013
@Nephele Nephele reopened this Feb 26, 2013
@dcbarans
Copy link

I would love to see this get into the library

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

Successfully merging this pull request may close these issues.

None yet

2 participants