Bug #86684
Updated by Arne Bracht about 4 years ago
**Hi, Hi, I came across this problem when trying to copy news records in the backend. h2. \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: <pre> $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; } } </pre> 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: <pre> $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; } } </pre> This seems to work, however I am not sure, if this may have unwanted side effects. Regards, Philipp