Skip to content

Commit 7a775c7

Browse files
author
Hayder Sharhan
committed
MAGETWO-51296: [Github] Multiple calls to getCountryInfo result in a fatal error #3858
- Fixed collection to not only obtain info from one country.
1 parent e362879 commit 7a775c7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/code/Magento/Directory/Model/CountryInformationAcquirer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,17 @@ public function getCountryInfo($countryId)
9696
$store->getCode()
9797
);
9898

99-
$countries = $this->directoryHelper->getCountryCollection($store)->addCountryIdFilter($countryId)->load();
100-
if ($countries->count() == 0) {
99+
$countriesCollection = $this->directoryHelper->getCountryCollection($store)->load();
100+
101+
if ($countriesCollection->count() == 0) {
101102
throw new NoSuchEntityException(
102103
__(
103104
'Requested country is not available.'
104105
)
105106
);
106107
}
107108
$regions = $this->directoryHelper->getRegionData();
108-
$country = $countries->getItemById($countryId);
109+
$country = $countriesCollection->getItemById($countryId);
109110
$countryInfo = $this->setCountryInfo($country, $regions, $storeLocale);
110111

111112
return $countryInfo;

0 commit comments

Comments
 (0)