diff --git a/libraries/classes/Gis/GisMultiLineString.php b/libraries/classes/Gis/GisMultiLineString.php index 1b48f62d3291..f445162af2cd 100644 --- a/libraries/classes/Gis/GisMultiLineString.php +++ b/libraries/classes/Gis/GisMultiLineString.php @@ -298,7 +298,7 @@ public function prepareRowAsOl($spatial, int $srid, $label, $line_color, array $ */ public function generateWkt(array $gis_data, $index, $empty = '') { - $data_row = $gis_data[$index]['MULTILINESTRING']; + $data_row = $gis_data[$index]['MULTILINESTRING'] ?? null; $no_of_lines = $data_row['no_of_lines'] ?? 1; if ($no_of_lines < 1) { diff --git a/libraries/classes/Gis/GisMultiPolygon.php b/libraries/classes/Gis/GisMultiPolygon.php index f276e04fff59..c3835a7d867c 100644 --- a/libraries/classes/Gis/GisMultiPolygon.php +++ b/libraries/classes/Gis/GisMultiPolygon.php @@ -377,7 +377,7 @@ private function drawPath($polygon, array $scale_data) */ public function generateWkt(array $gis_data, $index, $empty = '') { - $data_row = $gis_data[$index]['MULTIPOLYGON']; + $data_row = $gis_data[$index]['MULTIPOLYGON'] ?? null; $no_of_polygons = $data_row['no_of_polygons'] ?? 1; if ($no_of_polygons < 1) { diff --git a/test/classes/Gis/GisGeometryCollectionTest.php b/test/classes/Gis/GisGeometryCollectionTest.php index 42b366cda35b..53f85f0d1ad9 100644 --- a/test/classes/Gis/GisGeometryCollectionTest.php +++ b/test/classes/Gis/GisGeometryCollectionTest.php @@ -116,6 +116,96 @@ public function providerForGenerateWkt(): array ]; return [ + [ + [ + 'gis_type' => 'GEOMETRYCOLLECTION', + 'srid' => '0', + 'GEOMETRYCOLLECTION' => [ + 'geom_count' => '1', + ], + 0 => [ + 'gis_type' => 'POINT', + ], + ], + 0, + null, + 'GEOMETRYCOLLECTION(POINT( ))', + ], + [ + [ + 'gis_type' => 'GEOMETRYCOLLECTION', + 'srid' => '0', + 'GEOMETRYCOLLECTION' => [ + 'geom_count' => '1', + ], + 0 => [ + 'gis_type' => 'LINESTRING', + ], + ], + 0, + null, + 'GEOMETRYCOLLECTION(LINESTRING( , ))', + ], + [ + [ + 'gis_type' => 'GEOMETRYCOLLECTION', + 'srid' => '0', + 'GEOMETRYCOLLECTION' => [ + 'geom_count' => '1', + ], + 0 => [ + 'gis_type' => 'POLYGON', + ], + ], + 0, + null, + 'GEOMETRYCOLLECTION(POLYGON(( , , , )))', + ], + [ + [ + 'gis_type' => 'GEOMETRYCOLLECTION', + 'srid' => '0', + 'GEOMETRYCOLLECTION' => [ + 'geom_count' => '1', + ], + 0 => [ + 'gis_type' => 'MULTIPOINT', + ], + ], + 0, + null, + 'GEOMETRYCOLLECTION(MULTIPOINT( ))', + ], + [ + [ + 'gis_type' => 'GEOMETRYCOLLECTION', + 'srid' => '0', + 'GEOMETRYCOLLECTION' => [ + 'geom_count' => '1', + ], + 0 => [ + 'gis_type' => 'MULTILINESTRING', + ], + ], + 0, + null, + 'GEOMETRYCOLLECTION(MULTILINESTRING(( , )))', + ], + [ + [ + 'gis_type' => 'GEOMETRYCOLLECTION', + 'srid' => '0', + 'GEOMETRYCOLLECTION' => [ + 'geom_count' => '1', + ], + 0 => [ + 'gis_type' => 'MULTIPOLYGON', + ], + ], + 0, + null, + 'GEOMETRYCOLLECTION(MULTIPOLYGON((( , , , ))))', + ], [ $temp1, 0,