always use object type for details keywords

When name and address is empty, the keywords field in the response
of the details API would be an array because that is what PHP's
json_encode defaults to with empty array(). This default can only
be changed globally per json_encode call and that might cause
unintended colleteral damage. Work around the issue by making
name and address an empty array instead of keywords.

Fixes #2329.
This commit is contained in:
Sarah Hoffmann 2021-05-17 16:36:32 +02:00
parent 925726222f
commit fef1bbb1a7

View File

@ -81,10 +81,14 @@ if ($bIncludeKeywords) {
if ($aPlaceSearchNameKeywords) {
$aPlaceDetails['keywords']['name'] = array_map($funcMapKeyword, $aPlaceSearchNameKeywords);
} else {
$aPlaceDetails['keywords']['name'] = array();
}
if ($aPlaceSearchAddressKeywords) {
$aPlaceDetails['keywords']['address'] = array_map($funcMapKeyword, $aPlaceSearchAddressKeywords);
} else {
$aPlaceDetails['keywords']['address'] = array();
}
}