simplemap icon indicating copy to clipboard operation
simplemap copied to clipboard

Map parts type error - property_exists() passed an array

Open samhibberd opened this issue 1 year ago • 0 comments

Found a somewhat critical issue (for us anyway), during normalizeValue() there is a method that populates missing data / parts: https://github.com/ethercreative/simplemap/blob/ff88b5565a217d92510fc7260b846b689aa6ff63/src/services/MapService.php#L281-L284

We recently identified that we were restricting our api key and as a result this call wasn't working (see #https://github.com/ethercreative/simplemap/issues/296#issuecomment-2239502532)

We temporarily worked around this by removing restrictions for our geoToken but as a result any unsaved events, that needed to be accessed via the front end were being normalized, grabbing missing data from google and setting it as an array on the Map model.

The the parts property on the map model can accept an array: https://github.com/ethercreative/simplemap/blob/ff88b5565a217d92510fc7260b846b689aa6ff63/src/models/BaseLocation.php#L38

Although if it is an array you are going to run into an error here: https://github.com/ethercreative/simplemap/blob/ff88b5565a217d92510fc7260b846b689aa6ff63/src/models/Map.php#L82

Likely related to this: https://github.com/ethercreative/simplemap/issues/181

samhibberd avatar Jul 23 '24 16:07 samhibberd