[BUGFIX] Fetch related records for existing uids only 47/31947/2
authorJo Hasenau <info@cybercraft.de>
Thu, 24 Jul 2014 18:52:12 +0000 (20:52 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Sat, 2 Aug 2014 10:59:48 +0000 (12:59 +0200)
Before fetching related records from a foreign table, we must ensure
that there is a uid to be considered, since otherwise we will fetch
any record having a 0 value for that field.

There are method calls in the core, that don't provide a uid, so the
default value 0 is used, i.e. when fetching children of translated
gridelements, causing memory outage when tt_content is > 10000 records.

Resolves: #60494
Releases: 6.3, 6.2
Change-Id: I1105964f98f79074bb37dc1921180b493fac4bc6
Reviewed-on: http://review.typo3.org/31947
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index 8c7bdee..a493cda 100644 (file)
@@ -2078,7 +2078,7 @@ class BackendUtility {
                                                                $l = $value;
                                                        } else {
                                                                $rParts = array();
-                                                               if (isset($theColConf['foreign_field']) && $theColConf['foreign_field'] !== '') {
+                                                               if ($uid && isset($theColConf['foreign_field']) && $theColConf['foreign_field'] !== '') {
                                                                        $records = self::getRecordsByField($theColConf['foreign_table'], $theColConf['foreign_field'], $uid);
                                                                        if (!empty($records)) {
                                                                                foreach ($records as $record) {