vhs icon indicating copy to clipboard operation
vhs copied to clipboard

BUG: Exception when "<v:page.rootline>" is used and pageUid doesn't exist

Open Oktopuce opened this issue 2 months ago • 1 comments

I have checked that the bug exists in the dev-development branch Yes.

I have checked that there are no already open issues or recently closed issues about this bug Yes.

Describe the bug When you're trying to get the root line of a page that doesn't exist, a PageNotFoundException exception is thrown:

(1/1) #1343589451 TYPO3\CMS\Core\Exception\Page\PageNotFoundException

To Reproduce Steps to reproduce the behavior:

  1. Insert in a Fluid Template, a bloc like this:
<v:page.rootline pageUid="{linkNotInDb}" as="theRootLine">
    ...
</v:page.rootline>

with {linkNotInDb} having a page Uid that doesn't exist in DB.

  1. Display the page with this code in frontend
  2. See exception

Expected behavior No PageNotFoundException exception should be thrown

Additional context In file vhs/Classes/Service/PageService.php, method getRootLine() the call to $rootLineUtility->get() must be surrounded by try{} catch()

try {
    /** @var RootlineUtility $rootLineUtility */
    $rootLineUtility = GeneralUtility::makeInstance(RootlineUtility::class, $pageUid);
    $rootline = $rootLineUtility->get();
} catch (PageNotFoundException $e) {
    return [];
}

Oktopuce avatar Apr 23 '24 15:04 Oktopuce