Problem/Motivation
When saving a node with a Geolocation Geometry - Geometry field, the save operation fails with a fatal error if we use a full GeoJSON "Feature" structure.
Error: Object of class stdClass could not be converted to string in Drupal\geolocation_geometry\GeometryFormat\GeoJSON::geometryByText() (line 32 of modules/contrib/geolocation/modules/geolocation_geometry/src/GeometryFormat/GeoJSON.php).
Steps to reproduce
Add a backend field of type Geolocation Geometry - Geometry to a Node bundle.
Enter
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
3.9785224,
50.9663602
],
[
3.983492,
50.9664819
],
[
3.9823442,
50.9627594
],
[
3.9654607,
50.9631484
],
[
3.9691041,
50.9775058
],
[
3.9841286,
50.9721607
],
[
3.9785224,
50.9663602
]
]
]
}
}Proposed resolution
Fix that line to properly serialize the nested geometry stdClass data object into a valid JSON text string
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3613831-3.patch | 1.09 KB | hmdnawaz |
Issue fork geolocation-3613831
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
hmdnawaz commentedPatch from the MR
Comment #5
christianadamski commentedThanks!