From 1294311278ba8cb4e46913c67993707a34f5579b Mon Sep 17 00:00:00 2001 From: Dinis Lage Date: Mon, 28 Oct 2013 13:23:01 +0000 Subject: [PATCH] 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 --- GeoIP/CRN.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeoIP/CRN.php b/GeoIP/CRN.php index d39057a..4458aaf 100644 --- a/GeoIP/CRN.php +++ b/GeoIP/CRN.php @@ -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];