decode_json() always create arrays instead of objects

This commit is contained in:
Sarah Hoffmann
2022-07-09 09:10:21 +02:00
parent 300612c5a8
commit 7cafec0750
9 changed files with 10 additions and 10 deletions

View File

@@ -445,7 +445,7 @@ class PlaceLookup
if ($this->bExtraTags) { if ($this->bExtraTags) {
if ($aPlace['extra']) { if ($aPlace['extra']) {
$aPlace['sExtraTags'] = json_decode($aPlace['extra']); $aPlace['sExtraTags'] = json_decode($aPlace['extra'], true);
} else { } else {
$aPlace['sExtraTags'] = (object) array(); $aPlace['sExtraTags'] = (object) array();
} }
@@ -482,7 +482,7 @@ class PlaceLookup
return (object) array(); return (object) array();
} }
$aFullNames = json_decode($sNames); $aFullNames = json_decode($sNames, true);
$aNames = array(); $aNames = array();
foreach ($aFullNames as $sKey => $sValue) { foreach ($aFullNames as $sKey => $sValue) {

View File

@@ -56,7 +56,7 @@ if (empty($aPlace)) {
} }
if (isset($aPlace['asgeojson'])) { if (isset($aPlace['asgeojson'])) {
$aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson']); $aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson'], true);
} else { } else {
$aFilteredPlaces['geometry'] = array( $aFilteredPlaces['geometry'] = array(
'type' => 'Point', 'type' => 'Point',

View File

@@ -65,7 +65,7 @@ if (empty($aPlace)) {
} }
if (isset($aPlace['asgeojson'])) { if (isset($aPlace['asgeojson'])) {
$aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson']); $aFilteredPlaces['geometry'] = json_decode($aPlace['asgeojson'], true);
} else { } else {
$aFilteredPlaces['geometry'] = array( $aFilteredPlaces['geometry'] = array(
'type' => 'Point', 'type' => 'Point',

View File

@@ -63,7 +63,7 @@ if (empty($aPlace)) {
} }
if (isset($aPlace['asgeojson'])) { if (isset($aPlace['asgeojson'])) {
$aFilteredPlaces['geojson'] = json_decode($aPlace['asgeojson']); $aFilteredPlaces['geojson'] = json_decode($aPlace['asgeojson'], true);
} }
if (isset($aPlace['assvg'])) { if (isset($aPlace['assvg'])) {

View File

@@ -48,7 +48,7 @@ $aPlaceDetails['centroid'] = array(
'coordinates' => array( (float) $aPointDetails['lon'], (float) $aPointDetails['lat'] ) 'coordinates' => array( (float) $aPointDetails['lon'], (float) $aPointDetails['lat'] )
); );
$aPlaceDetails['geometry'] = json_decode($aPointDetails['asgeojson']); $aPlaceDetails['geometry'] = json_decode($aPointDetails['asgeojson'], true);
$funcMapAddressLine = function ($aFull) { $funcMapAddressLine = function ($aFull) {
return array( return array(

View File

@@ -60,7 +60,7 @@ foreach ($aBatchResults as $aSearchResults) {
} }
if (isset($aPointDetails['asgeojson'])) { if (isset($aPointDetails['asgeojson'])) {
$aPlace['geojson'] = json_decode($aPointDetails['asgeojson']); $aPlace['geojson'] = json_decode($aPointDetails['asgeojson'], true);
} }
if (isset($aPointDetails['assvg'])) { if (isset($aPointDetails['assvg'])) {

View File

@@ -46,7 +46,7 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
} }
if (isset($aPointDetails['asgeojson'])) { if (isset($aPointDetails['asgeojson'])) {
$aPlace['geometry'] = json_decode($aPointDetails['asgeojson']); $aPlace['geometry'] = json_decode($aPointDetails['asgeojson'], true);
} else { } else {
$aPlace['geometry'] = array( $aPlace['geometry'] = array(
'type' => 'Point', 'type' => 'Point',

View File

@@ -54,7 +54,7 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
} }
if (isset($aPointDetails['asgeojson'])) { if (isset($aPointDetails['asgeojson'])) {
$aPlace['geometry'] = json_decode($aPointDetails['asgeojson']); $aPlace['geometry'] = json_decode($aPointDetails['asgeojson'], true);
} else { } else {
$aPlace['geometry'] = array( $aPlace['geometry'] = array(
'type' => 'Point', 'type' => 'Point',

View File

@@ -53,7 +53,7 @@ foreach ($aSearchResults as $iResNum => $aPointDetails) {
} }
if (isset($aPointDetails['asgeojson'])) { if (isset($aPointDetails['asgeojson'])) {
$aPlace['geojson'] = json_decode($aPointDetails['asgeojson']); $aPlace['geojson'] = json_decode($aPointDetails['asgeojson'], true);
} }
if (isset($aPointDetails['assvg'])) { if (isset($aPointDetails['assvg'])) {