Bug #79853

Exception when setting "Language" to "all" for new and/or existing content elements in backend

Added by Michael Fruehmann over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Localization
Target version:
Start date:
2017-02-16
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:
Stabilization Sprint

Description

I have a very weird issue on TYPO3 8.6 and cannot find out where to start looking: It’s an almost empty installation with a main and a second language, whenever I try t o set a content element to “Language ALL” i get an exception in the backend.
If I set the sys_language_uid to -1 manually in the DB the content element is shown with the “all” settings and displayed correctly in the frontend, but I cannot add or edit another content element on the same page (always throws same error).
I setup a TYPO3 7.6 with exactly the same setup and it works as expected there. It does not depend on any language overlay TS settings.

(See attached animated gif) or https://dl.dropboxusercontent.com/u/81358/jing/language-all.gif

Argument 3 passed to TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor::synchronizeFieldValues() must be of the type array, null given, called in /Applications/MAMP/htdocs/__typo3_source/typo3_src-8.6.0/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php on line 253 

TypeError thrown in file
/Applications/MAMP/htdocs/__typo3_source/typo3_src-8.6.0/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php in line 323.

PHP version used was 7.0.12.
(this is my first core bug that I file, please be considerate if I forgot something :)

language-all.gif View (169 KB) Michael Fruehmann, 2017-02-16 10:56


Related issues

Related to TYPO3 Core - Feature #79658: Introduce allowLanguageSynchronization Closed 2017-02-07
Related to TYPO3 Core - Bug #79872: records throw an error on language -1 Closed 2017-02-17
Related to TYPO3 Core - Bug #83940: L10nModeUpdater breaks if parent of translations is deleted Closed 2018-02-16

Associated revisions

Revision f52349ad (diff)
Added by Timo Hund over 2 years ago

[BUGFIX] Exception when setting "language" to "all" for content elements

Currently you get an error in the backend when you try to set the
language to "all" for a new or existing content element (integer was
expected but null received triggers PHP strict type error).

The reason for this is, that the DataMapProcessor tries to sychronize
elements from tt_content with uid 0.

This patch adds an integration test that content elements without an
existing source do not get synronized.

Resolves: #79853
Releases: master
Change-Id: I67d4b35efe1564c13e9faf085c4848f2d0313998
Reviewed-on: https://review.typo3.org/51804
Tested-by: Claus Due <>
Tested-by: TYPO3com <>
Reviewed-by: Claus Due <>
Reviewed-by: Johannes Goslar <>
Reviewed-by: Morten Pless <>
Reviewed-by: Jasmina Ließmann Tested-by: Jasmina Ließmann <code@frauliessmann.de> Reviewed-by: Nicole Cordes <typo3@cordes.co> Tested-by: Nicole Cordes <typo3@cordes.co>

Revision 7d92cdc8 (diff)
Added by Oliver Hader over 2 years ago

[FOLLOWUP][BUGFIX] Exception when setting "language" to "all" for content

The initial change just hid a misbehavior when dealing with a content
element that was defined for the non-existing "all language". In this
case no localizations are possible and the data-map item shall not be
considered at all. This change makes the exception on language "-1"
more explicit and does not hide these side-effects.

Besides that, the functional tests were extended to check the complete
scenario for the defined language to be tested in the frontend.

Change-Id: I336e0e5c3994e21b9b8a17818b3dc0ab1c2a1b3a
Resolves: #79853
Releases: master
Reviewed-on: https://review.typo3.org/51962
Tested-by: TYPO3com <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>
Reviewed-by: Joerg Kummer <>
Tested-by: Joerg Kummer <>
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>

History

#1 Updated by Christian Kuhn over 2 years ago

  • Priority changed from -- undefined -- to Must have
  • Sprint Focus set to Stabilization Sprint

#2 Updated by Georg Ringer over 2 years ago

  • Status changed from New to Accepted
  • Is Regression changed from No to Yes

#3 Updated by Timo Hund over 2 years ago

I am looking at this

#4 Updated by Nicole Cordes over 2 years ago

  • Assignee set to Timo Hund

#5 Updated by Timo Hund over 2 years ago

I had a look on the issue. The reason for the error is, that in the method synchronizeTranslationItem BackendUtility::getRecordWSOL is called with tt_content, and record uid 0 in this case and this record can't exist.

When i add a check in the method "synchronizeTranslationItem" and skip the sychronisation process then (what makes sence in my opinion) i don't get this error anymore:

    protected function synchronizeTranslationItem(DataMapItem $item, array $fieldNames, int $fromId)
    {
        if ($fromId === 0) {
            return;
        }
         ...

Since i am not so deep in the translation handling i don't know if this could have any other side effects. Maybe somebody else can help and knows why this can happen?

#6 Updated by Gerrit Code Review over 2 years 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/51804

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

#8 Updated by Gerrit Code Review over 2 years 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/51804

#9 Updated by Gerrit Code Review over 2 years 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/51804

#10 Updated by Gerrit Code Review over 2 years 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/51804

#11 Updated by Gerrit Code Review over 2 years 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/51804

#12 Updated by Gerrit Code Review over 2 years 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/51804

#13 Updated by Timo Hund over 2 years ago

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

#14 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Resolved 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/51962

#15 Updated by Oliver Hader over 2 years ago

  • Status changed from Under Review to Resolved

#16 Updated by Bert Hiddink over 2 years ago

When upgrading from 7.x to 8.7.2 and running the step "Execute database migrations on single rows" with the upgradeWizard from Install Tool, I get the following error:

Argument 3 passed to TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor::synchronizeFieldValues() must be of the type array, null given, called in typo3_src-8.7.2/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php on line 316

TypeError thrown in file
typo3_src-8.7.2/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php in line 384.

Seems very similar to this bug https://forge.typo3.org/issues/79853 but this seems already having been resolved in the 8.6-branch.

Any ideas where this error comes from?

#17 Updated by christian rauch about 2 years ago

This happens with translated records whose parents are deleted (deleted=1)

for example:

tt_content:

uid=1, l18n_parent=0, sys_language_uid=0, deleted=1
uid=2, l18n_parent=1, sys_language_uid=1, deleted=0 ======> Error

I didn't dig any deeper as i tried to update from a typo3 4.5 Project to 8 LTS and there were only 2 records where this error happened

#18 Updated by Jonas Enders about 2 years ago

To fix the problem mentioned by christian rauch, I wrote a sql statement:

CREATE TEMPORARY TABLE tmp SELECT child.uid FROM tt_content AS parent INNER JOIN tt_content AS child ON (child.l18n_parent = parent.uid) WHERE parent.deleted = 1 AND child.deleted = 0;
DELETE FROM tt_content WHERE uid IN (SELECT uid FROM tmp);
DROP TABLE tmp;

#19 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

#20 Updated by Kurt Gusbeth almost 2 years ago

Uncaught TYPO3 Exception
Argument 3 passed to TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor::synchronizeFieldValues() must be of the type array, null given, called in /html/typo3/typo3_src-8.7.8/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php on line 320

TypeError thrown in file
/html/typo3/typo3_src-8.7.8/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php in line 384.

and

CREATE TEMPORARY TABLE tmp SELECT child.uid FROM tt_content AS parent INNER JOIN tt_content AS child ON (child.l18n_parent = parent.uid) WHERE parent.deleted = 1 AND child.deleted = 0;
  1. MySQL lieferte ein leeres Resultat zurück (d.h. null Datensätze).
    DELETE FROM tt_content WHERE uid IN (SELECT uid FROM tmp);
  2. MySQL lieferte ein leeres Resultat zurück (d.h. null Datensätze).
    DROP TABLE tmp;
  3. MySQL lieferte ein leeres Resultat zurück (d.h. null Datensätze).

Nothing helped for me.
I fixed it like this:

        foreach ($fieldNames as $fieldName) {
            if (is_array($fromRecord) && is_array($forRecord)) {
                $this->synchronizeFieldValues(
                    $item,
                    $fieldName,
                    $fromRecord,
                    $forRecord
                );
            }
        }

#21 Updated by Martin Waue over 1 year ago

I had to delete child records without parent records.


SELECT uid,l18n_parent FROM `tt_content` WHERE l18n_parent NOT IN (SELECT uid FROM tt_content) AND l18n_parent > 0

#22 Updated by Joerg Kummer over 1 year ago

  • Related to Bug #83940: L10nModeUpdater breaks if parent of translations is deleted added

#23 Updated by Joerg Kummer over 1 year ago

I added a patch at #83940 with the suggestion from Kurt Gusbeth

Also available in: Atom PDF