From 2a4692ca8ceb7967a1b2eb1f8b67dd4ef7f86f7b Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 15 Aug 2015 09:52:48 +0200 Subject: [PATCH] fix json output of empty arrays --- lib/Geocode.php | 4 ++-- lib/PlaceLookup.php | 4 ++-- lib/template/address-json.php | 2 +- lib/template/address-jsonv2.php | 2 +- lib/template/search-jsonv2.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Geocode.php b/lib/Geocode.php index a3ac4f0e..afeaf687 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -1796,7 +1796,7 @@ } else { - $aResult['sExtraTags'] = array(); + $aResult['sExtraTags'] = (object) array(); } } @@ -1808,7 +1808,7 @@ } else { - $aResult['sNameDetails'] = array(); + $aResult['sNameDetails'] = (object) array(); } } diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index 23b97707..c5129fee 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -127,7 +127,7 @@ } else { - $aPlace['sExtraTags'] = array(); + $aPlace['sExtraTags'] = (object) array(); } } @@ -139,7 +139,7 @@ } else { - $aPlace['sNameDetails'] = array(); + $aPlace['sNameDetails'] = (object) array(); } } diff --git a/lib/template/address-json.php b/lib/template/address-json.php index c994eb02..ff245e14 100644 --- a/lib/template/address-json.php +++ b/lib/template/address-json.php @@ -26,5 +26,5 @@ if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['namedetails'] = $aPlace['sNameDetails']; } - javascript_renderData($aFilteredPlaces, JSON_FORCE_OBJECT); + javascript_renderData($aFilteredPlaces); diff --git a/lib/template/address-jsonv2.php b/lib/template/address-jsonv2.php index f05dbd80..a8a05dd4 100644 --- a/lib/template/address-jsonv2.php +++ b/lib/template/address-jsonv2.php @@ -38,4 +38,4 @@ if (isset($aPlace['sNameDetails'])) $aFilteredPlaces['namedetails'] = $aPlace['sNameDetails']; } - javascript_renderData($aFilteredPlaces, JSON_FORCE_OBJECT); + javascript_renderData($aFilteredPlaces); diff --git a/lib/template/search-jsonv2.php b/lib/template/search-jsonv2.php index 8006e3c2..e9747720 100644 --- a/lib/template/search-jsonv2.php +++ b/lib/template/search-jsonv2.php @@ -79,4 +79,4 @@ $aFilteredPlaces[] = $aPlace; } - javascript_renderData($aFilteredPlaces, array('geojson')); + javascript_renderData($aFilteredPlaces); -- 2.39.5