Bug #84542
closedNo return value check in SoftReferenceParserHook
0%
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
],
]
]
];
Updated by Rens Admiraal over 6 years ago
just found why I had this state, it was a copied database for testing purpose without the yaml definitions of forms.
Updated by Riccardo De Contardi about 6 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!
Updated by Riccardo De Contardi over 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
Updated by Rens Admiraal over 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"
Updated by Christian Eßl over 4 years ago
This should have been fixed with #89665 in 9.5 and master.
Updated by Christian Eßl over 4 years ago
- Related to Bug #89665: PHP error when updating database reference index after removing an extension that provided a form definition added
Updated by Susanne Moog over 4 years ago
- Status changed from New to Closed
This has been fixed with #89665.