Bug #86684

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

Added by Philipp Seiler about 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & 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

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

Actions
#1

Updated by Susanne Moog about 3 years ago

  • Sprint Focus set to On Location Sprint
#2

Updated by Philipp Seiler about 3 years ago

  • Priority changed from Should have to Must have

TYPO3 9.5.1 made changes to the method \TYPO3\CMS\Core\DataHandling\SlugHelper->isUniqueInSite(). The problem still persists however, or rather, a new exception shows up. This happens for example if you try to update the slug of a news record.

Argument 1 passed to TYPO3\CMS\Core\DataHandling\Model\RecordStateFactory::TYPO3\CMS\Core\DataHandling\Model\{closure}() must be of the type string, null given

I guess I better keep the old version of the method and my bugfix for now.

Edit: No, slug generation seems to be completely broken now. Better go back to 9.5.0.

#3

Updated by Alexander Jaschke about 3 years ago

I can confirm that. It is not possible to copy or move news articles.
Not working in 9.5.0 and 9.5.1 with these errors.

#4

Updated by Steffen Dietrich about 3 years ago

Can you provide some additional informations? I m testing this on 9.5.2 and can't reproduce it.
Or maybe I did something wrong? I got two News-folder, two List-view-pages and two Detail-pages and I can copy/move the news without any trouble.
I can also copy-paste-edit-show news within the same folder, no issues at all....am I missing something?

#5

Updated by Gerrit Code Review almost 3 years ago

  • Status changed from New to Under Review

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/59229

#6

Updated by Gerrit Code Review almost 3 years ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59453

#7

Updated by Benni Mack almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#8

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed
#9

Updated by Arne Bracht Bracht about 1 year ago

  • Description updated (diff)

Seems back in 9.5.21

Can't edit/new category "No pseudo-site found in root line of page

#10

Updated by Rene Tobias Tobias about 1 year ago

Arne Bracht Bracht wrote:

Seems back in 9.5.21

Can't edit/new category "No pseudo-site found in root line of page

Same here.

#11

Updated by Arne Bracht Bracht about 1 year ago

  • Copied to Bug #92331: No pseudo-site found in root line of page added

Also available in: Atom PDF