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

PhoneNumberMetadata_XX file with \r\n while str_replace use PHP_EOL... #17

Open
djxhero opened this issue May 9, 2013 · 0 comments
Open

Comments

@djxhero
Copy link

djxhero commented May 9, 2013

files download to windows and Some how is my fault , \n turns to \r\n. I just note this issue here
For example :

  1. PhoneNumberMetadata_CN file
    return array (
    'generalDesc' =>
    array (
    'NationalNumberPattern' => '\r\n
    [1-79]\d{7,11}|\r\n
    8[0-357-9]\d{6,9}\r\n
    ',
    .....

And
2. PhoneNumberUtil.php
private function isNumberMatchingDesc($nationalNumber, PhoneNumberDesc $numberDesc) {
...
$nationalNumberPatternMatcher = preg_match('/^(' . str_replace(array(PHP_EOL, ' '), '', $numberDesc->getNationalNumberPattern()) . ')$/', $nationalNumber);
return $possibleNumberPatternMatcher && $nationalNumberPatternMatcher;
}

use PHP_EOL to find and replace when PHP_EOL in linux is \n

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

1 participant