[BUGFIX] Workspace not always applied in RelationHandler queries 86/31286/2
authorOliver Hader <oliver@typo3.org>
Wed, 2 Jul 2014 09:28:32 +0000 (11:28 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Wed, 2 Jul 2014 10:39:50 +0000 (12:39 +0200)
The possibly submitted value to RelationHandler::setWorkspaceId()
is not used for SQL queries to read IRRE foreign field relations.
In that case the current $BE_USER->workspace value is used which
might be different to the requested workspace id.

Resolves: #60053
Releases: 6.2, 6.3
Change-Id: Ib01e4df798ff2e1fcc8c29997f6effb814dc4344
Reviewed-on: https://review.typo3.org/31286
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/core/Classes/Database/RelationHandler.php

index dbc0846..736f113 100644 (file)
@@ -818,7 +818,7 @@ class RelationHandler {
                }
                // Select children from the live(!) workspace only
                if (BackendUtility::isTableWorkspaceEnabled($foreign_table)) {
-                       $workspaceList = '0,' . (int)$GLOBALS['BE_USER']->workspace;
+                       $workspaceList = '0,' . $this->getWorkspaceId();
                        $whereClause .= ' AND ' . $foreign_table . '.t3ver_wsid IN (' . $workspaceList . ') AND ' . $foreign_table . '.pid<>-1';
                }
                // Get the correct sorting field