Check if the country-region combination exists.

Check that a given country and region combination for an IP exists in
$crnMap.
Fix issue reported by @xifrin in
https://github.com/dlage/yii-geoip/pull/2
This commit is contained in:
2013-10-28 13:23:01 +00:00
parent 591383f287
commit 1294311278

View File

@@ -4513,7 +4513,7 @@ class GeoIP_CRN {
* @return string Metro region name.
*/
public static function getRegionName($countryCode, $regionCode) {
if ($countryCode === null || $regionCode === null) {
if ($countryCode === null || $regionCode === null || !isset(self::$crnMap[$countryCode][$regionCode])) {
return null;
}
return self::$crnMap[$countryCode][$regionCode];