Project

General

Profile

Actions

Bug #84542

closed

No return value check in SoftReferenceParserHook

Added by Rens Admiraal about 6 years ago. Updated about 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 #1

Updated by Rens Admiraal about 6 years ago

just found why I had this state, it was a copied database for testing purpose without the yaml definitions of forms.

Actions #2

Updated by Riccardo De Contardi over 5 years ago

  • Status changed from New to Needs Feedback

@Rens Admiraal I feel sorry for this very late answer;

I've not understood if this issue can be closed or is there still work to do on this topic. If it is so, could you add a full guide about how to reproduce your issue? Thank you!

Actions #3

Updated by Riccardo De Contardi about 5 years ago

  • Status changed from Needs Feedback to Closed

No feedback since the last 90 days => closing this issue.

If you think that this is the wrong decision or experience the issue again and have more information about how to reproduce your problem, please reopen it or open a new issue with a reference to this one.

Thank you and best regards

Actions #4

Updated by Rens Admiraal about 5 years ago

Hi Riccardo,

And then sorry for my late reply, I don't monitor my forge ;-)

But I don't know how to give a guide to reproduce the invalid state, but it's also not needed imho. \TYPO3\CMS\Form\Hooks\SoftReferenceParserHook::findRef calls ->getUid() on $file. $file is retrieved from \TYPO3\CMS\Core\Resource\ResourceFactory::retrieveFileOrFolderObject and this function has at minimum 2 ways to return null.

When \TYPO3\CMS\Core\Resource\ResourceFactory::retrieveFileOrFolderObject returns null the call to ->getUid() with fail with a fatal error "calling ->getUid() on null"

Actions #5

Updated by Riccardo De Contardi about 5 years ago

  • Status changed from Closed to New

Reopened.

Actions #6

Updated by Christian Eßl about 4 years ago

This should have been fixed with #89665 in 9.5 and master.

Actions #7

Updated by Christian Eßl about 4 years ago

  • Related to Bug #89665: PHP error when updating database reference index after removing an extension that provided a form definition added
Actions #8

Updated by Susanne Moog about 4 years ago

  • Status changed from New to Closed

This has been fixed with #89665.

Actions

Also available in: Atom PDF