Bug #86857
closedLinkvalidator task crashes with an isMissing Called on Null error
100%
Description
The Following Code in TYPO3\CMS\Linkvalidator\Linktype\FileLinktype does not handle the possible return value of $resourceFactory->retrieveFileOrFolderObject which returns null in certain cases.
It also seems like the documentation of retrieveFileOrFolderObject does not hint the possibility that a null value can be returned.
public function checkLink($url, $softRefEntry, $reference)
{
$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
try {
$file = $resourceFactory->retrieveFileOrFolderObject($url);
} catch (FileDoesNotExistException $e) {
return false;
} catch (FolderDoesNotExistException $e) {
return false;
}
return !$file->isMissing();
}
I would propose something like this:
public function checkLink($url, $softRefEntry, $reference)
{
$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
try {
$file = $resourceFactory->retrieveFileOrFolderObject($url);
} catch (FileDoesNotExistException $e) {
return false;
} catch (FolderDoesNotExistException $e) {
return false;
}
if (!is_null($file) {
return !$file->isMissing();
} else {
return false;
}
}
Updated by Sybille Peters about 6 years ago
If you wish to submit a patch, see https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/
Updated by Gerrit Code Review about 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58849
Updated by Gerrit Code Review about 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58849
Updated by Gerrit Code Review about 6 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58849
Updated by Gerrit Code Review about 6 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58849
Updated by Gerrit Code Review about 6 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58849
Updated by Gerrit Code Review about 6 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58849
Updated by Gerrit Code Review about 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58850
Updated by Anonymous about 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 582b91167d0a04a9100b6a8baf2bd370fdbf2cde.