Skip to content

Commit 24f0dc9

Browse files
xserratjbelien
authored andcommitted
Issue #946 - Apply utf8_encode only if the field is not null in MaxMindBinary (#947)
1 parent b2b068f commit 24f0dc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

MaxMindBinary.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ public function geocodeQuery(GeocodeQuery $query): Collection
104104
Address::createFromArray([
105105
'providedBy' => $this->getName(),
106106
'countryCode' => $geoIpRecord->country_code,
107-
'country' => utf8_encode($geoIpRecord->country_name),
107+
'country' => null === $geoIpRecord->country_name ? null : utf8_encode($geoIpRecord->country_name),
108108
'adminLevels' => $adminLevels,
109-
'locality' => utf8_encode($geoIpRecord->city),
109+
'locality' => null === $geoIpRecord->city ? null : utf8_encode($geoIpRecord->city),
110110
'latitude' => $geoIpRecord->latitude,
111111
'longitude' => $geoIpRecord->longitude,
112112
'postalCode' => $geoIpRecord->postal_code,

0 commit comments

Comments
 (0)