Commit f52349ad authored by Timo Schmidt's avatar Timo Schmidt Committed by Nicole Cordes
Browse files

[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's avatarClaus Due <claus@phpmind.net>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Claus Due's avatarClaus Due <claus@phpmind.net>
Reviewed-by: Johannes Goslar's avatarJohannes Goslar <jogo@kronberger-spiele.de>
Reviewed-by: default avatarMorten Pless <mpl@systime.dk>
Reviewed-by: default avatarJasmina Ließmann <code@frauliessmann.de>
Tested-by: default avatarJasmina Ließmann <code@frauliessmann.de>
Reviewed-by: Nicole Cordes's avatarNicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes's avatarNicole Cordes <typo3@cordes.co>
parent 809cd7c1
......@@ -192,6 +192,10 @@ class DataMapProcessor
foreach ($this->filterItemsByType($type) as $item) {
foreach ($item->getApplicableScopes() as $scope) {
$fromId = $item->getIdForScope($scope);
if (empty($fromId)) {
continue;
}
$fieldNames = $this->getFieldNamesForItemScope($item, $scope, !$item->isNew());
$this->synchronizeTranslationItem($item, $fieldNames, $fromId);
}
......
......@@ -65,6 +65,17 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
$this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][0];
}
/**
* Creation of a content element with language set to all
*
* @see DataSet/createContentForLanguageAll.csv
*/
public function createContentForLanguageAll()
{
$newTableIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Language set to all', 'sys_language_uid' => -1]);
$this->recordIds['newContentLanguageAll'] = $newTableIds[self::TABLE_Content][0];
}
/**
* @see DataSet/modifyContentRecord.csv
*/
......
......@@ -42,6 +42,21 @@ class ActionTest extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\A
->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1', 'Testing #2'));
}
/**
* @test
* @see DataSet/createContentForLanguageAll.csv
*/
public function createContentForLanguageAll()
{
parent::createContentForLanguageAll();
$this->assertAssertionDataSet('createContentForLanguageAll');
$responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
$this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
->setTable(self::TABLE_Content)->setField('header')->setValues('Language set to all'));
}
/**
* @test
* @see DataSet/modifyContentRecord.csv
......
tt_content,,,,,,,,,,,,,,
,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,l10n_source,t3_origuid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
,297,89,256,0,0,0,0,0,0,0,0,0,0,Regular Element #1
,298,89,512,0,0,0,0,0,0,0,0,0,0,Regular Element #2
,299,89,768,0,0,0,0,0,0,0,0,0,0,Regular Element #3
,300,89,1024,0,1,299,299,299,0,0,0,0,0,[Translate to Dansk:] Regular Element #3
,301,89,384,0,1,297,297,297,0,0,0,0,0,[Translate to Dansk:] Regular Element #1
,302,89,448,0,2,297,301,301,0,0,0,0,0,[Translate to Deutsch:] [Translate to Dansk:] Regular Element #1
,303,89,128,0,-1,0,0,0,0,0,0,0,0,Language set to all
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment