diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 885f635150878efc4d85fed7a5dfba70234fd1c6..66c7f7b32515a64b9697cbb441c4c9bc7cc6cd37 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -4776,14 +4776,14 @@ class DataHandler implements LoggerAwareInterface // before (un-)deleting this record, check for child records or references $this->deleteRecord_procFields($table, $uid, $undeleteRecord); try { - GeneralUtility::makeInstance(ConnectionPool::class) - ->getConnectionForTable($table) - ->update($table, $updateFields, ['uid' => (int)$uid]); // Delete all l10n records as well, impossible during undelete because it might bring too many records back to life if (!$undeleteRecord) { $this->deletedRecords[$table][] = (int)$uid; $this->deleteL10nOverlayRecords($table, $uid); } + GeneralUtility::makeInstance(ConnectionPool::class) + ->getConnectionForTable($table) + ->update($table, $updateFields, ['uid' => (int)$uid]); } catch (DBALException $e) { $databaseErrorMessage = $e->getPrevious()->getMessage(); } diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/TranslatedSubpages.csv b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/TranslatedSubpages.csv new file mode 100644 index 0000000000000000000000000000000000000000..93b6eb65504080ac5f79fc7b685a4fe345d27933 --- /dev/null +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/TranslatedSubpages.csv @@ -0,0 +1,10 @@ +"sys_language",,,,,,,,,,,,,,,,,, +,"uid","pid","hidden","title","flag",,,,,,,,,,,,, +,1,0,0,"Dansk","dk",,,,,,,,,,,,, +,2,0,0,"Deutsch","de",,,,,,,,,,,,, +"pages",,,,,,,,,,,,,,,,,, +,"uid","pid","title","sys_language_uid","l10n_parent",,,,,,,,,,,,, +,1,0,"Startpage",0,0,,,,,,,,,,,,, +,2,0,"Startpage - Dansk",1,1,,,,,,,,,,,,, +,3,1,"Subpage",0,0,,,,,,,,,,,,, +,4,1,"Subpage - Dansk",1,3,,,,,,,,,,,,, diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DeleteTranslatedSubpagesTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DeleteTranslatedSubpagesTest.php new file mode 100644 index 0000000000000000000000000000000000000000..bc863eee974283ddd9265d26f8f996221117a0b8 --- /dev/null +++ b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DeleteTranslatedSubpagesTest.php @@ -0,0 +1,54 @@ +<?php + +namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler; + +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ + +use TYPO3\CMS\Core\DataHandling\DataHandler; +use TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase; +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * Functional test for deleting page with translated subpage + */ +class DeleteTranslatedSubpagesTest extends AbstractDataHandlerActionTestCase +{ + /** + * @var string + */ + protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/'; + + protected function setUp(): void + { + parent::setUp(); + $this->importScenarioDataSet('TranslatedSubpages'); + $this->backendUser->workspace = 0; + $this->backendUser->uc['recursiveDelete'] = true; + } + + /** + * @test + */ + public function deletePageCausesNoErrorsWithTranslatedSubpage(): void + { + $uid = 1; + $cmd['pages'][$uid]['delete'] = 1; + + $dataHandler = GeneralUtility::makeInstance(DataHandler::class); + $dataHandler->start([], $cmd); + $dataHandler->process_cmdmap(); + + self::assertEquals($dataHandler->errorLog, []); + } +}