Project

General

Profile

Actions

Bug #75271

closed

TYPO3\CMS\Core\Imaging\IconFactory::getIconForRecord() throws an exception in some cases

Added by Petra Arentzen about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2016-03-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

TYPO3\CMS\Core\Imaging\IconFactory::getIconForRecord() throws an exception about wrong parameter-type for second argument which is NULL but should be an array, if 'internal_type' is 'DB' and "prepend_tname" is set to false in TCA-FieldConf
In that case a fallback is done:
src/typo3_src/typo3/sysext/backend/Classes/Form/Element/GroupElement.php:276 - 291

                foreach ($temp_itemArray as $dbRead) {
                    $recordParts = explode('|', $dbRead);
                    list($this_table, $this_uid) = BackendUtility::splitTable_Uid($recordParts[0]);
                    // For the case that no table was found and only a single table is defined to be allowed, use that one:
                    if (!$this_table && $onlySingleTableAllowed) {
                        $this_table = $allowed;
                    }
                    $itemArray[] = array('table' => $this_table, 'id' => $this_uid);
                    if (!$disabled && $show_thumbs) {
                        $rr = BackendUtility::getRecordWSOL($this_table, $this_uid);
                        $thumbnails[] = array(
                            'name' => BackendUtility::getRecordTitle($this_table, $rr, true),
                            'image' => $this->iconFactory->getIconForRecord($this_table, $rr, Icon::SIZE_SMALL)->render(),
                            'path' => BackendUtility::getRecordPath($rr['pid'], $perms_clause, 15),
                            'uid' => $rr['uid'],
                            'table' => $this_table
                        );
                    }
                }

I think this must be changed:

                    if (!$this_table && $onlySingleTableAllowed) {
                        $this_table = $allowed;
                    }

                    if (!$this_table && $onlySingleTableAllowed) {
                        $this_table = reset($allowed);
                    }

Otherwise $rr is set to NULL and the Exception is thrown.
Also perhaps always the case where record is not found should be handled?


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #76232: IconFactory::getIconForRecord() throws an exception in some cases (contrary to former feedback)ClosedPetra Arentzen2016-05-18

Actions
Actions

Also available in: Atom PDF