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/psalm-baseline.xml b/psalm-baseline.xml
index ce5b2ef1179f..6010c30e3a10 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -6969,10 +6969,9 @@
$temp_point[1]
$wkt
-
+
$data_row[$i]
$data_row['no_of_lines']
- $gis_data[$index]['MULTILINESTRING']
$point['x']
$point['y']
$point[0]
@@ -7030,6 +7029,10 @@
$black
$color
+
+ $data_row[$i]
+ $data_row['no_of_lines']
+
isset(self::$instance)
@@ -7120,11 +7123,10 @@
$ring['points']
$wkt
-
+
$data_row[$k]
$data_row[$k]
$data_row['no_of_polygons']
- $gis_data[$index]['MULTIPOLYGON']
$innerPoint['x']
$innerPoint['y']
$label_point[0]
@@ -7229,6 +7231,11 @@
$black
$color
+
+ $data_row[$k]
+ $data_row[$k]
+ $data_row['no_of_polygons']
+
isset(self::$instance)
diff --git a/test/classes/Gis/GisGeometryCollectionTest.php b/test/classes/Gis/GisGeometryCollectionTest.php
index 42b366cda35b..aa4ae50d2c4f 100644
--- a/test/classes/Gis/GisGeometryCollectionTest.php
+++ b/test/classes/Gis/GisGeometryCollectionTest.php
@@ -116,6 +116,72 @@ 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,