Project

General

Profile

Actions

Bug #99529

closed

Duplicate slugs with collisions using TCA type "slug" and records with sys_language_uid = -1

Added by Sybille Peters over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2023-01-12
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
tca,slug,duplicate slugs,language handling
Complexity:
Is Regression:
Sprint Focus:

Description

Here, there is a collision with uid=4 and uid=5 as well as uid=4 and uid=6. They all have the slug 'hallo-2' which would be ok if the language differs, but sys_language_uid=-1 means the record will be shown for all languages

select uid,sys_language_uid,deleted,hidden,slug,title from db.tx_sypetsexampleslug_something;
+-----+------------------+---------+--------+-------------------+---------------------+
| uid | sys_language_uid | deleted | hidden | slug              | title               |
+-----+------------------+---------+--------+-------------------+---------------------+
|   1 |                0 |       0 |      0 | hallo             | hallo               |
|   2 |                0 |       0 |      0 | halloeoe-usw-blah | hallöö usw. blah    |
|   3 |                0 |       0 |      0 | hallo-1           | hallo               |
|   4 |               -1 |       0 |      0 | hallo-2           | hallo               |
|   5 |                6 |       0 |      0 | hallo-2           | hallo               |
|   6 |                0 |       0 |      0 | hallo-2           | hallo               |
+-----+------------------+---------+--------+-------------------+---------------------+

Reproduce

There is a minimal extension to reproduce issue which works with v12: https://github.com/sypets/sypets_example_slug

1. Use an extension with slug field (e.g. calendarize or sypets_example_slug)
2. Create several records with the same slugs. Create at least one record with sys_language_uid=-1 (you may have to save once and then generate the slug again to create the duplicate)

The problem can be reproduced with news + TYPO3 v11, calendarize and TYPO3 v11 and TYPO3 v12 and the example extension sypets_example_slug.

or check existing content for extensions, e.g.

news (language 0 or -1):

select path_segment,count(*) as c from tx_news_domain_model_news where not hidden and not deleted and (sys_language_uid=0 || sys_language_uid=-1) group by path_segment order by c;

calendarize (language 0 or -1):

select slug,count(*) as c from tx_calendarize_domain_model_event where not hidden and not deleted and (sys_language_uid=0 || sys_language_uid=-1) group by slug order by c;

Versions

Source code example

// slug field
        'slug' => [
            'exclude' => false,
            'label' => 'slug',
            'config' => [
                'type' => 'slug',
                'generatorOptions' => [
                    'fields' => ['title'],
                    'fieldSeparator' => '/',
                    'prefixParentPageSlug' => true,
                    'replacements' => [
                        '/' => '',
                    ],
                ],
                'fallbackCharacter' => '-',
                'eval' => 'unique',
                'default' => ''
            ]
        ],

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #98629: Saving a record with TCA type=slug and sys_language_uid=1 may result in duplicate slugClosed2022-10-17

Actions
Related to TYPO3 Core - Bug #98456: Slug generation for language ID -1Closed2022-09-28

Actions
Actions #1

Updated by Sybille Peters over 1 year ago

  • Description updated (diff)
Actions #2

Updated by Sybille Peters over 1 year ago

  • Description updated (diff)
Actions #3

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

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

Actions #4

Updated by Gerrit Code Review over 1 year ago

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

Actions #5

Updated by Gerrit Code Review over 1 year ago

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

Actions #6

Updated by Sybille Peters over 1 year ago

  • Subject changed from It is possible to create duplicate slugs with collisions using TCA type "slug" and records with sys_language_uid = -1 to Duplicate slugs with collisions using TCA type "slug" and records with sys_language_uid = -1
Actions #7

Updated by Sybille Peters over 1 year ago

  • Related to Bug #98629: Saving a record with TCA type=slug and sys_language_uid=1 may result in duplicate slug added
Actions #8

Updated by Gerrit Code Review over 1 year ago

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

Actions #9

Updated by Gerrit Code Review over 1 year ago

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

Actions #10

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 11.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/+/77407

Actions #11

Updated by Sybille Peters over 1 year ago

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

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions #13

Updated by Georg Ringer about 1 month ago

  • Related to Bug #98456: Slug generation for language ID -1 added
Actions

Also available in: Atom PDF