From 1e4de7fec4ef45ae3477a80099587e1c6efa2b86 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 16 Oct 2018 18:21:51 +0200 Subject: [PATCH 1/2] Forced explicit string casting when hydrating a VisitLocation from an array --- module/Core/src/Entity/VisitLocation.php | 14 +++++----- module/Core/test/Entity/VisitLocationTest.php | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 module/Core/test/Entity/VisitLocationTest.php diff --git a/module/Core/src/Entity/VisitLocation.php b/module/Core/src/Entity/VisitLocation.php index 2027f7e32..f00a5db62 100644 --- a/module/Core/src/Entity/VisitLocation.php +++ b/module/Core/src/Entity/VisitLocation.php @@ -136,25 +136,25 @@ public function setTimezone(string $timezone): self public function exchangeArray(array $array): void { if (\array_key_exists('country_code', $array)) { - $this->setCountryCode($array['country_code']); + $this->setCountryCode((string) $array['country_code']); } if (\array_key_exists('country_name', $array)) { - $this->setCountryName($array['country_name']); + $this->setCountryName((string) $array['country_name']); } if (\array_key_exists('region_name', $array)) { - $this->setRegionName($array['region_name']); + $this->setRegionName((string) $array['region_name']); } if (\array_key_exists('city', $array)) { - $this->setCityName($array['city']); + $this->setCityName((string) $array['city']); } if (\array_key_exists('latitude', $array)) { - $this->setLatitude($array['latitude']); + $this->setLatitude((string) $array['latitude']); } if (\array_key_exists('longitude', $array)) { - $this->setLongitude($array['longitude']); + $this->setLongitude((string) $array['longitude']); } if (\array_key_exists('time_zone', $array)) { - $this->setTimezone($array['time_zone']); + $this->setTimezone((string) $array['time_zone']); } } diff --git a/module/Core/test/Entity/VisitLocationTest.php b/module/Core/test/Entity/VisitLocationTest.php new file mode 100644 index 000000000..d6ccac46e --- /dev/null +++ b/module/Core/test/Entity/VisitLocationTest.php @@ -0,0 +1,27 @@ + 1000.7, + 'longitude' => -2000.4, + ]; + + $location = new VisitLocation(); + $location->exchangeArray($payload); + + $this->assertSame('1000.7', $location->getLatitude()); + $this->assertSame('-2000.4', $location->getLongitude()); + } +} From a74fe62da6d5c78bb0b0d32fc060795ad1f8dfed Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 16 Oct 2018 18:27:56 +0200 Subject: [PATCH 2/2] Added v1.13.1 to changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d58ceedb5..486dddac2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # CHANGELOG +## 1.13.1 - 2018-10-16 + +#### Added + +* *Nothing* + +#### Changed + +* *Nothing* + +#### Deprecated + +* *Nothing* + +#### Removed + +* *Nothing* + +#### Fixed + +* [#231](https://github.com/shlinkio/shlink/issues/197) Fixed error when processing visits. + + ## 1.13.0 - 2018-10-06 #### Added