Bug #76977

DataHandler doesn't recognize doktype for Alternative Page Language the right way

Added by Daniel Siepmann over 3 years ago. Updated 9 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
DataHandler aka TCEmain
Target version:
Start date:
2016-07-07
Due date:
% Done:

0%

TYPO3 Version:
7
PHP Version:
7.0
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

It's possible to configure allowed tables per page type via https://docs.typo3.org/typo3cms/CoreApiReference/PageTypes/Index.html .
As soon as you have configure to not allow "pages" below a specific page type everything works as expected for records of type "pages" but not for "Alternative Page Language".

The process is handled in TYPO3\CMS\Core\DataHandling\DataHandler::checkValue where:

// Processing special case of field pages.doktype                                         
if (($table === 'pages' || $table === 'pages_language_overlay') && $field === 'doktype') {

Inside this condition, $theWrongTables = $this->doesPageHaveUnallowedTables($id, $value); is called which will do $count = $this->databaseConnection->exec_SELECTcountRows('uid', $table, 'pid=' . (int)$page_uid); so not taking care of the real uid.

Fix
The $id passed to doesPageHaveUnallowedTables has to be the real uid, so in case of pages_language_overlay it has to be the pid instead of uid.

basic_fix.diff View (1.03 KB) Daniel Siepmann, 2016-07-20 08:53

History

#1 Updated by Nicole Cordes over 3 years ago

  • Assignee set to Nicole Cordes
  • Sprint Focus set to On Location Sprint

#2 Updated by Nicole Cordes over 3 years ago

  • Status changed from New to Needs Feedback

Hi Daniel,

I would love to be able to reproduce your problem. Would you mind to offer your configuration as well as your use case. I think I understand the problem but I'd like to verify it before solving.

BTW: Do you know how to contribute to the TYPO3 Core using Gerrit as review system? As you already have a solution for your problem, you could easily provide the patch.

#3 Updated by Daniel Siepmann over 3 years ago

Here is a basic fix that should work.

But as $realPid can be -1 and I don't know all circumstances of this method, I'm not sure whether this will be incompatible with further issues.

TYPO3 should check the real page, thus the pid in case of language overlays.

#4 Updated by Daniel Siepmann over 3 years ago

Once more I try to describe how to reproduce the issue.

Configure allowed tables via https://docs.typo3.org/typo3cms/CoreApiReference/PageTypes/Index.html .
Configure one page type to not allow pages, so it's not possible to provide subpages.
Create one page and a language overlay.
Create another page with same uid as the language overlay has. This page should not allow pages.

Try to update the doktype of the language overlay. It will fail as not the pid of the overlay, the real page uid, will be used, but the uid of the language overlay. TYPO3 will look up the page with uid of the overlay, this is configured to not allow overlays.
Thus the editor will get a warning that the table is not allowed.

#5 Updated by Riccardo De Contardi about 3 years ago

  • Status changed from Needs Feedback to New

#6 Updated by Susanne Moog over 2 years ago

  • Complexity changed from easy to medium

#7 Updated by Anja Leichsenring about 2 years ago

  • Sprint Focus deleted (On Location Sprint)

#8 Updated by Daniel Siepmann 9 months ago

  • Status changed from New to Closed

This should be solved with release of 9.x where the table has gone and only pages is left.

Also available in: Atom PDF