Project

General

Profile

Actions

Bug #86684

closed

"No pseudo-site found in root line of page" when copying records from one sysfolder to another

Added by Philipp Seiler about 6 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2018-10-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
slug,route,speaking,url,pseudo,copy,news
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

**Hi,
I came across this problem when trying to copy news records in the backend.

\TYPO3\CMS\Core\DataHandling\SlugHelper->isUniqueInSite()

When copying a record, the isUniqueInSite() method is called to check if the news slug needs adjustment. This may trigger a No pseudo-site found in root line of page exception, depending on what pages are currently available in the backend.

It seems that the problem is found here:

$siteMatcher = GeneralUtility::makeInstance(SiteMatcher::class);
$siteOfCurrentRecord = $siteMatcher->matchByPageId($pageId);
foreach ($records as $record) {
    $siteOfExistingRecord = $siteMatcher->matchByPageId((int)$record['uid']);
    if ($siteOfExistingRecord->getRootPageId() === $siteOfCurrentRecord->getRootPageId()) {
        return false;
    }
}

As far as I understand, the method $siteMatcher->matchByPageId((int)$record['uid']) will work only correctly, if the current table is "pages". When copying news records, $record['uid'] will contain the news' UID, and a matchByPageId->call is made with that UID. Sometimes this may work, depending on if that page happens to exists or not.

As for now I have created a workaround for this problem:

$siteMatcher = GeneralUtility::makeInstance(SiteMatcher::class);
$siteOfCurrentRecord = $siteMatcher->matchByPageId($pageId);
foreach ($records as $record) {
    if ($this->tableName === 'pages') {
        $siteOfExistingRecord = $siteMatcher->matchByPageId((int) $record['uid']);
    }
    else {
        $siteOfExistingRecord = $siteMatcher->matchByPageId((int) $record['pid']);
    }

    if ($siteOfExistingRecord->getRootPageId() === $siteOfCurrentRecord->getRootPageId()) {
        return false;
    }
}

This seems to work, however I am not sure, if this may have unwanted side effects.

Regards,
Philipp


Related issues 1 (0 open1 closed)

Copied to TYPO3 Core - Bug #92331: No pseudo-site found in root line of pageClosed2020-09-17

Actions
Actions

Also available in: Atom PDF