Bug #86684

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

Added by Philipp Seiler 11 months ago. Updated 5 months ago.

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

100%

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

Associated revisions

Revision b3c17046 (diff)
Added by Benni Mack 8 months ago

[BUGFIX] Fix various "No pseudo-site found in root line of page" errors

Fixes workspace resolving etc.

The !empty statement is wrong as a string value "0" would not expect the
right return. This fixes the detection of l10n_parent.
Also check for sys_language_uid, too, to get the pid of the record
instead of its parent.

This also fixes opening categories (sys_category) when using EXT:news,
which calls this condition in TCA:
'displayCond' => 'USER:' . \TYPO3\CMS\Core\Compatibility\
PseudoSiteTcaDisplayCondition::class . '->isInPseudoSite:pages:false',

Check array index exists in SiteResolving.

Resolves: #79606
Resolves: #86186
Resolves: #86622
Resolves: #86678
Resolves: #86684
Releases: master, 9.5
Change-Id: If3ddf5eead2dddd51db3bcf751d71d3bc362ef35
Reviewed-on: https://review.typo3.org/59229
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

Revision aa08d433 (diff)
Added by Benni Mack 8 months ago

[BUGFIX] Fix various "No pseudo-site found in root line of page" errors

Fixes workspace resolving etc.

The !empty statement is wrong as a string value "0" would not expect the
right return. This fixes the detection of l10n_parent.
Also check for sys_language_uid, too, to get the pid of the record
instead of its parent.

This also fixes opening categories (sys_category) when using EXT:news,
which calls this condition in TCA:
'displayCond' => 'USER:' . \TYPO3\CMS\Core\Compatibility\
PseudoSiteTcaDisplayCondition::class . '->isInPseudoSite:pages:false',

Check array index exists in SiteResolving.

Resolves: #79606
Resolves: #86186
Resolves: #86622
Resolves: #86678
Resolves: #86684
Releases: master, 9.5
Change-Id: If3ddf5eead2dddd51db3bcf751d71d3bc362ef35
Reviewed-on: https://review.typo3.org/59453
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

History

#1 Updated by Susanne Moog 11 months ago

  • Sprint Focus set to On Location Sprint

#2 Updated by Philipp Seiler 11 months 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 11 months 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 10 months 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 8 months 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 8 months 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 8 months ago

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

#8 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF