Project

General

Profile

Actions

Bug #96651

open

When pasting a page with redirects => error 'Attempt to insert record "sys_redirect…'

Added by Wolfgang Klinger almost 3 years ago. Updated 9 months ago.

Status:
Under Review
Priority:
Must have
Assignee:
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2022-01-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Steps to reproduce:

- Create a new page, save
- Rename page, update slug => creates a redirect (check pid in table sys_redirect)
- Copy this page and paste into another page
- The following error message is thrown:

1: Attempt to insert record "sys_redirect:3" on a page (8) that can't store record type.

(the UID (8) is the one of the newly inserted page)


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #99697: Copying a page with existing sys_redirect throws errorClosed2023-01-24

Actions
Actions #1

Updated by Wolfgang Klinger almost 3 years ago

  • Description updated (diff)
Actions #2

Updated by Stefan Bürk over 2 years ago

  • Assignee set to Stefan Bürk
Actions #3

Updated by Gerrit Code Review over 2 years 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/+/75020

Actions #4

Updated by Rozbeh Chiryai Sharahi over 2 years ago

This happens also on version 12


The reason for the error message

sys_redirect table is not allowed on standard pages


How to proceed

I think this depends on the answer to the question: "Should redirects be allowed on standard pages?".


If yes

It might be simple: "[BUGFIX] Allow sys_redirect on standard pages". (I could provide a patch, if needed)


If no

In this case we assume that sys_redirect is not allowed on standard pages for good reasons. For example: Avoid spreading redirects in page-tree, ...

The auto-redirects, however, get stored on standard-pages (the page which has a changed slug), which, on copy-pasting a page, leads to the attempt of data-handler to insert redirects on a target which is a standard-page. Summary: auto-redirects are created on standard-pages although not allowed by TCA.

Therefore, i see two more interesting possibilities to tackle this:

1) Change redirects extension to not create redirects on standard-pages (might be quite some work)
2) Introduce an option to exclude tables to be copied along with pages (would not directly address the issue and is rather a feature than a bugfix)

The reason I think 2) can be an option is that copying redirects along with pages could be wrong in many many cases. I'd think redirects belong to the copied pages most of the time ... unless it's a copied sys-folder, were the redirects are some kind of "pack-of-disabled-redirect-templates" or so. However in that case, it would still be possible to reactivate via TCA and allow sys-redirect entries on standard pages, on project level.

I provided a WIP patch for 2, in case it is considered a good solution.

Actions #5

Updated by Gerrit Code Review over 2 years 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/+/75020

Actions #6

Updated by Oliver Gassner over 1 year ago

  • Has duplicate Bug #99697: Copying a page with existing sys_redirect throws error added
Actions #7

Updated by Markus Klein about 1 year ago

I stipulate: redirects must never be copied.

Actions #8

Updated by Andy Meier 10 months ago

@Rozbeh Chiryai Sharahi you patch set, applied separately by composer patches, resolves the problem in our 11.5.30 installation.

@Stefan Bürk I hope, the fix will make it's way to the main branch soon.

Thanks to all for your effort!

Actions #9

Updated by Rozbeh Chiryai Sharahi 9 months ago

Andy Meier wrote in #note-8:

@Rozbeh Chiryai Sharahi you patch set, applied separately by composer patches, resolves the problem in our 11.5.30 installation.

@Stefan Bürk I hope, the fix will make it's way to the main branch soon.

Thanks to all for your effort!

Happy to hear that. If further support is needed, let me know.

Actions

Also available in: Atom PDF