Index: branches/5.2.x/core/units/helpers/country_states_helper.php =================================================================== diff -u -N -r16704 -r16776 --- branches/5.2.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 16704) +++ branches/5.2.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 16776) @@ -1,6 +1,6 @@ Application->getCache($cache_key); + + if ( $cache_value === false ) { + $sql = 'SELECT IsoCode, ShortIsoCode FROM ' . TABLE_PREFIX . 'CountryStates - WHERE ShortIsoCode = ' . $this->Conn->qstr($iso_code) . ' AND `Type` = ' . DESTINATION_TYPE_COUNTRY; + WHERE `Type` = ' . DESTINATION_TYPE_COUNTRY; + $cache_value = $this->Conn->GetCol($sql, 'ShortIsoCode'); + $this->Application->setCache($cache_key, $cache_value); } - else { - $sql = 'SELECT ShortIsoCode - FROM ' . TABLE_PREFIX . 'CountryStates - WHERE IsoCode = ' . $this->Conn->qstr($iso_code) . ' AND `Type` = ' . DESTINATION_TYPE_COUNTRY; - } - return $this->Conn->GetOne($sql); + return $from_short ? $cache_value[$iso_code] : array_search($iso_code, $cache_value); } + }