davideme / libphonenumber-for-PHP

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

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

Open djxhero opened 11 years ago

djxhero commented 11 years ago

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

  1. 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