Bug #87884

Root page of page tree suddenly gets slug "/1"

Added by Soren Malling 4 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Link Handling, Site Handling & Routing
Target version:
Start date:
2019-03-11
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

This is a issue created for Benni Mack to follow up on a Slack conversation

https://typo3.slack.com/archives/C2ZKN8P7G/p1551805852037400

Screen-Shot-2019-03-11-at-15.36.54.png View (682 KB) Soren Malling, 2019-03-11 15:37


Related issues

Related to TYPO3 Core - Bug #87454: Slug/URL segment - /1 is wrongly saved, when trying to set / on rootpage. New 2019-01-16
Related to TYPO3 Core - Bug #86727: Numeric in slugs on multidomain instances. Needs Feedback 2018-10-24

Associated revisions

Revision 67eddfc1 (diff)
Added by Benni Mack 2 months ago

[BUGFIX] Respect uniqueInSite when moving records

When a page is moved from one site to another site
(two pagetrees with different sites), currently a duplicate
slug is possible. This should never happen, so the same
logic as for "uniqueInPid" is applied when moving records.

Resolves: #87884
Releases: master, 9.5
Change-Id: I9a2d5756958e09fa89fbbc384d03c0503b70bf8c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534
Tested-by: TYPO3com <>
Tested-by: Susanne Moog <>
Tested-by: Georg Ringer <>
Reviewed-by: Susanne Moog <>
Reviewed-by: Georg Ringer <>

Revision 20e303a2 (diff)
Added by Benni Mack 2 months ago

[BUGFIX] Respect uniqueInSite when moving records

When a page is moved from one site to another site
(two pagetrees with different sites), currently a duplicate
slug is possible. This should never happen, so the same
logic as for "uniqueInPid" is applied when moving records.

Resolves: #87884
Releases: master, 9.5
Change-Id: I9a2d5756958e09fa89fbbc384d03c0503b70bf8c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60686
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Soren Malling 4 months ago

In some cases the root page gets the slug "/1" after editing page properties and sometimes without doing so. The screenshot contains the communication from Slack

#2 Updated by Guido Schmechel 4 months ago

  • Related to Bug #87454: Slug/URL segment - /1 is wrongly saved, when trying to set / on rootpage. added

#4 Updated by Oliver Hader 4 months ago

SELECT uid, pid, slug, t3ver_state, sys_language_uid, l10n_parent
FROM pages
WHERE (slug = '/') AND (uid <> [PAGE-ID])
AND (sys_language_uid = 0)
AND (t3ver_wsid IN (0))
AND (pid <> -1)
AND (pages.deleted = 0)

Please execute the following SQL statement, replace PAGE-ID with the page that you have been modified and post the results.
For each of the results, please add the name or root-page uid of the according site configuration as well.

#5 Updated by Oliver Hader 4 months ago

  • Status changed from New to Needs Feedback

#6 Updated by Soren Malling 4 months ago

SELECT uid, pid, slug, t3ver_state, sys_language_uid, l10n_parent
FROM pages
WHERE (slug = '/') AND (uid <> 1)
AND (sys_language_uid = 0)
AND (t3ver_wsid IN (0))
AND (pid <> -1)
AND (pages.deleted = 0)

uid 1 is the root page of www.meteko.dk. The returned result is the following

{
    "data":
    [
        {
            "uid": 2,
            "pid": 0,
            "slug": "/",
            "t3ver_state": 0,
            "sys_language_uid": 0,
            "l10n_parent": 0
        },
        {
            "uid": 14,
            "pid": 1,
            "slug": "/",
            "t3ver_state": 0,
            "sys_language_uid": 0,
            "l10n_parent": 0
        }
    ]
}

Page uid 2 is a different pagetree from a different (not active site). "lejrguide" (as the site is called) is having rootPageId: 2 in it's config file

Page uid 14 is a separator page used for visualising a split in my page tree.

What is not returned is the actual page (uid=1) where the issue occured and neither is a translated version of the uid=1 (expected since we only look for sys_language_uid = 1

#7 Updated by Soren Malling 4 months ago

Just pasting the findings me and Oliver found during a walkthrough of the issue.

Here is what came to my mind during the chat.

I have been doing a lot lately with `.disabled = 1` on  a number of fields. I found out (when localizing content) that the sys_language_uid wasn’t saved becuase i had disabled it. I might have, in a early stage of the page, disabled the `slug` field, because it’s not a “editor” thing to work with that. And since that, the slug was never created for some pages and there “empty” or “/” untill i reactivated the `slug` field

For this reason I had a "divider" page created as a moment in time where the slug field was disabled, and therefore never filled (or given "/"). So, later when I re-enabled the slug field and went to page properties of my page, changed the title and clicked "save", the SlugHelper found out that "/" was already taken and then gave the frontpage "/1" which is the uid of the page.

#8 Updated by Oliver Hader 4 months ago

  • Status changed from Needs Feedback to Accepted

Thanks Søren, disabled or not visible slug fields are the key aspect here! Thanks for that valuable input!
In those scenarios the value will be empty... no auto-generation...

#9 Updated by Dmitry Dulepov 4 months ago

Slug was not disabled in our case. The page inside the root page was created as hidden. It got `/` as a slug. So the slug on the home page got `/1` because it must be unique within the site.

#10 Updated by Rony Khoury 4 months ago

In my case, the slug was not disabled. I accidentally created a new sys-folder outside the page-tree by dropping it after the page-tree (PID of sys-folder is 0). The sys-folder got the slug "/". I then moved the sys-folder inside the page-tree. The slug of the sys-folder is still "/". When you edit the root-page properties and hit "save", the slug of the root-page changes to "/1". Only after changing the slug of the sys-folder, I was able to set the correct slug for the root-page.

#11 Updated by Oliver Hader 4 months ago

In terms of actions items that means:

  • when creating new records having a slug field configured in $TCA, generate slug value in case it's not defined in the incomingFieldValue in DataHandler
  • when moving a record having a slug field configured in $TCA to a different page, ensure that slug value is unique in the new scenario (page or site) in DataHandler (maybe a move command hook)

#12 Updated by Dmitry Dulepov 4 months ago

I'd say the slug of a new or moved page should change to '/1', not the slug of the root page.

#13 Updated by Riccardo De Contardi 4 months ago

  • Category set to Link Handling, Site Handling & Routing

#14 Updated by Benni Mack 3 months ago

This is how I could reproduce this issue:

- Create a root page with site configuration

- Create a second root page without site configuration

- Move second page into first page

- Second page has "/", First page has "/"

- Now edit first page and "/1" is added.

This is due to the fact that DataHandler->moveRecord_raw() does not consider "uniqueInSite"

#15 Updated by Gerrit Code Review 3 months ago

  • Status changed from Accepted to Under Review

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

#16 Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534

#17 Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534

#18 Updated by Gerrit Code Review 3 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534

#19 Updated by Gerrit Code Review 3 months ago

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/c/Packages/TYPO3.CMS/+/60534

#20 Updated by Gerrit Code Review 3 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534

#21 Updated by Benni Mack 3 months ago

  • Target version set to next-patchlevel

#22 Updated by Riccardo De Contardi 3 months ago

  • Related to Bug #86727: Numeric in slugs on multidomain instances. added

#23 Updated by Gerrit Code Review 2 months ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534

#24 Updated by Gerrit Code Review 2 months ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534

#25 Updated by Gerrit Code Review 2 months ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60534

#26 Updated by Benni Mack 2 months ago

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

#27 Updated by Gerrit Code Review 2 months ago

  • Status changed from Resolved to Under Review

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/c/Packages/TYPO3.CMS/+/60686

#28 Updated by Benni Mack 2 months ago

  • Status changed from Under Review to Resolved

#29 Updated by Benni Mack 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF