Bug #59225
open
Disabled Pages from Type Mount Point are still visible in Frontend
Added by Alex Kellner over 10 years ago.
Updated 7 months ago.
Description
System TYPO3 4.7.17
Scenario: Adding a Page of type "Mount Point" with a page from tree 1 in tree 2.
I want to have a new menu item "test" in my second tree.
Related page "News" should be shown. That works fine.
But even if I disable the Mount Point - it's possible to open the link
in frontend. I have to delete the mount point to disable the functionality.
- Status changed from New to Needs Feedback
- Assignee set to Mathias Schreiber
Yo Alex,
I need to know if I got that right:
You set the MountPoint to hidden but it will still show the target of the mountpoint.
Is that correct?
That's correct.
Because of the long time ago, I'm not sure if I was logged out from backend - but I think I tested it in a second browser - the link was still working in Frontend.
- Status changed from Needs Feedback to Closed
Tested, cannot reproduce :)
I can reproduce it on TYPO3 v12.4.9.
The mount point has mount_pid_ol=1
set.
Disabling the mount point page (hidden=1) still makes it accessible in the frontend. It does not appear in menus, though.
Steps to reproduce:
1. Create normal visible page
2. Create page of type "mount point", configure mount_pid_ol=1, hidden=0 and mount_pid to the ID of the first page
3. View mount point page, it shows the contents of the first page.
4. Disable mount point
5. View mount point page, it still shows the contents of the first page.
- Status changed from Closed to New
- TYPO3 Version changed from 4.7 to 12
When using a route path like /mp-test
, the "hidden" property of the mount point page is not used and delivers a 200 OK .
When passing the page ID via GET parameter in the URL (/mp-test?id=23
), the "hidden" property is used and a 404 "page not found" is returned.
This is because the core PageRouter
resolves the page ID from the URL path and already handles mount points, and returns the mount point destination page UID.
When manually passing in the ID via ?id=
GET parameter, the page router does not resolve the mount point target and passes the ID to TypoScriptFrontendController
. There the hidden property of the mount point page is checked before the target page is resolved.
This is on TYPO3 12.4.14.
Workaround: Register a listener for AfterPageWithRootLineIsResolvedEvent
event:
<?php
namespace Mogic\Dbi\Frontend\EventListener;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Controller\ErrorController;
use TYPO3\CMS\Frontend\Event\AfterPageWithRootLineIsResolvedEvent;
/**
* Send a 404 when the source mount point page is hidden.
* Workaround for TYPO3 bug #59225.
*
* @link https://forge.typo3.org/issues/59225
*/
class HiddenMountPointEventListener
{
public function __invoke(AfterPageWithRootLineIsResolvedEvent $event): void
{
$params = $event->getRequest()->getQueryParams();
if (!isset($params['MP'])) {
//not a mount point page
return;
}
list($targetUid, $mountPointUid) = explode('-', $params['MP']);
$tsfe = $event->getController();
$page = $tsfe->sys_page->getPage($mountPointUid);
if (!empty($page)) {
//mount point source page is available
return;
}
$response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
$event->getRequest(),
'The requested page does not exist!',
[
'hidden' => [
$mountPointUid => true
]
]
);
$event->setResponse($response);
}
}
Also available in: Atom
PDF