davideme / libphonenumber-for-PHP

PHP version of Google's phone number handling library
125 stars 71 forks source link

PhoneNumberUtil.php fails to recognize extensions #13

Closed Nephele closed 11 years ago

Nephele commented 11 years ago

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.