diff --git a/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php b/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
index 73ebfc461dc572cc330f08b43f01893378a2d6a4..00f6f4f03e6c9b38171e4be3d947b1166c2b2b44 100644
--- a/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
+++ b/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
@@ -941,7 +941,9 @@ abstract class AbstractTreeView
             if ($res < 0) {
                 $row = false;
             } else {
-                list(, $row) = each($this->dataLookup[$res][$this->subLevelID]);
+                $key = key($this->dataLookup[$res][$this->subLevelID]);
+                next($this->dataLookup[$res][$this->subLevelID]);
+                $row = $this->dataLookup[$res][$this->subLevelID][$key];
             }
             return $row;
         } else {
diff --git a/typo3/sysext/core/Classes/Database/QueryGenerator.php b/typo3/sysext/core/Classes/Database/QueryGenerator.php
index 1957ccc44b0a54bd5394d13ec6d5b9e5e787f6cb..321cc4edf3130aad5ac8a48f5816d524e17c1a9a 100644
--- a/typo3/sysext/core/Classes/Database/QueryGenerator.php
+++ b/typo3/sysext/core/Classes/Database/QueryGenerator.php
@@ -1206,7 +1206,7 @@ class QueryGenerator
         $retArr = [];
         while (is_array($arr)) {
             reset($arr);
-            list($key, ) = each($arr);
+            $key = key($arr);
             $retArr[] = $key;
             $arr = $arr[$key];
         }
diff --git a/typo3/sysext/core/Tests/Unit/Database/QueryGeneratorTest.php b/typo3/sysext/core/Tests/Unit/Database/QueryGeneratorTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0581c81a95565923cc155f923077a8e018672cb3
--- /dev/null
+++ b/typo3/sysext/core/Tests/Unit/Database/QueryGeneratorTest.php
@@ -0,0 +1,121 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Database;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Database\QueryGenerator;
+use TYPO3\CMS\Core\Tests\UnitTestCase;
+
+/**
+ * Test case
+ */
+class QueryGeneratorTest extends UnitTestCase
+{
+    /**
+     * @return array
+     */
+    public function getSubscriptReturnsExpectedValuesDataProvider()
+    {
+        return [
+            'multidimensional array input' => [
+                [
+                    'foo' => [
+                        'bar' => 1,
+                        'baz' => [
+                            'jane' => 1,
+                            'john' => 'doe',
+                        ],
+                        'fae' => 1,
+                    ],
+                    'don' => [
+                        'dan' => 1,
+                        'jim' => [
+                            'jon' => 1,
+                            'jin' => 'joh',
+                        ],
+                    ],
+                    'one' => [
+                        'two' => 1,
+                        'three' => [
+                            'four' => 1,
+                            'five' =>'six',
+                        ],
+                    ]
+                ],
+                [
+                    0 => 'foo',
+                    1 => 'bar',
+                ],
+            ],
+            'array with multiple entries input' => [
+                [
+                    'foo' => 1,
+                    'bar' => 2,
+                    'baz' => 3,
+                    'don' => 4,
+                ],
+                [
+                    0 => 'foo',
+                ],
+            ],
+            'array with one entry input' => [
+                [
+                    'foo' => 'bar',
+                ],
+                [
+                    0 => 'foo',
+                ],
+            ],
+            'empty array input' => [
+                [],
+                [
+                    0 => null,
+                ],
+            ],
+            'empty multidimensional array input' => [
+                [[[[]]], [[]], [[]]],
+                [
+                    0 => 0,
+                    1 => 0,
+                    2 => 0,
+                    3 => null,
+                ],
+            ],
+            'null input' => [
+                null,
+                [],
+            ],
+            'string input' => [
+                'foo bar',
+                [],
+            ],
+            'numeric input' => [
+                3.14,
+                [],
+            ],
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider getSubscriptReturnsExpectedValuesDataProvider
+     * @param $input
+     * @param array $expectedArray
+     */
+    public function getSubscriptReturnsExpectedValues($input, array $expectedArray)
+    {
+        $subject = new QueryGenerator();
+        $this->assertSame($expectedArray, $subject->getSubscript($input));
+    }
+}
diff --git a/typo3/sysext/workspaces/Classes/Service/StagesService.php b/typo3/sysext/workspaces/Classes/Service/StagesService.php
index 1bb434b7d9de7526d2cf207c6e91cedf907d4f58..c96f2c5130a020040f46abf5264dad9ae8afb006 100644
--- a/typo3/sysext/workspaces/Classes/Service/StagesService.php
+++ b/typo3/sysext/workspaces/Classes/Service/StagesService.php
@@ -615,11 +615,11 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface
                     if (trim($row['subgroup'])) {
                         // Make integer list
                         $theList = implode(',', GeneralUtility::intExplode(',', $row['subgroup']));
-                        // Get the subarray
-                        $subbarray = $this->fetchGroups($theList, $idList . ',' . $uid);
-                        list($subUid, $subArray) = each($subbarray);
-                        // Merge the subarray to the already existing userGroups array
-                        $this->userGroups[$subUid] = $subArray;
+                        // Get the subgroups
+                        $subGroups = $this->fetchGroups($theList, $idList . ',' . $uid);
+                        // Merge the subgroups to the already existing userGroups array
+                        $subUid = key($subGroups);
+                        $this->userGroups[$subUid] = $subGroups[$subUid];
                     }
                 }
             }