Project

General

Profile

Actions

Bug #84542

closed

No return value check in SoftReferenceParserHook

Added by Rens Admiraal over 6 years ago. Updated over 4 years ago.

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

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I currently seem to have an invalid state in a TYPO3 database, which causes an exception while updating the reference index. I will take care of fixing my database, but by reading the code I do think there's a lacking return value check in the SoftReferenceParserHook.

It's about line sysext/form/Classes/Hooks/SoftReferenceParserHook.php:59 calling $file->getUid() while $file can be null.

$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
        $file = $resourceFactory->retrieveFileOrFolderObject($content);

        return [
            'content' => '{softref:' . $tokenId . '}',
            'elements' => [
                $tokenId => [
                    'matchString' => $content,
                    'subst' => [
                        'type' => 'db',
                        'recordRef' => 'sys_file:' . $file->getUid(),
                        'tokenID' => $tokenId,
                        'tokenValue' => $content
                    ],
                ]
            ]
        ];

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #89665: PHP error when updating database reference index after removing an extension that provided a form definitionClosed2019-11-13

Actions
Actions

Also available in: Atom PDF