diff --git a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php index 4b2fbc6f773538e0a2d70edb753e6f3ced86d81d..53288e59741f2c70d92faab548b331e8fa25673f 100644 --- a/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php +++ b/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php @@ -661,7 +661,7 @@ class PageRepository implements LoggerAwareInterface $row['_ORIG_pid'] = $olrow['_ORIG_pid']; } foreach ($row as $fN => $fV) { - if ($fN !== 'uid' && $fN !== 'pid' && isset($olrow[$fN])) { + if ($fN !== 'uid' && $fN !== 'pid' && array_key_exists($fN, $olrow)) { $row[$fN] = $olrow[$fN]; } elseif ($fN === 'uid') { $row['_LOCALIZED_UID'] = $olrow['uid']; diff --git a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php index 1ebe86ed5e442002ead1280f942ffd80ba8b8273..ee99f71c08b4bbda6d4129048b56032c7f948bc8 100644 --- a/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php +++ b/typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php @@ -611,4 +611,25 @@ class PageRepositoryTest extends FunctionalTestCase self::assertFalse(isset($row['_PAGES_OVERLAY_UID'])); self::assertFalse(isset($row['_PAGES_OVERLAY_LANGUAGE'])); } + + /** + * @test + */ + public function getLanguageOverlayResolvesContentWithNullInValues(): void + { + $context = new Context(); + $context->setAspect('language', new LanguageAspect(1, 1, LanguageAspect::OVERLAYS_ON_WITH_FLOATING, [0])); + $subject = new PageRepository($context); + $record = $subject->getRawRecord('tt_content', 1); + self::assertSame('Default Content #1', $record['header']); + $overlaidRecord = $subject->getLanguageOverlay('tt_content', $record); + self::assertSame(2, (int)$overlaidRecord['_LOCALIZED_UID']); + self::assertSame('Translated Content #1', $overlaidRecord['header']); + + // Check if "bodytext" is actually overlaid with a NULL value + $record = $subject->getRawRecord('tt_content', 3); + $overlaidRecord = $subject->getLanguageOverlay('tt_content', $record); + self::assertSame('Translated #2', $overlaidRecord['header']); + self::assertNull($overlaidRecord['bodytext']); + } } diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml b/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml index 126169973cac925dc02bee7fd45a32d547b6340d..b0e7bdcedbda24e1203832b92612ef0920937024 100644 --- a/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml +++ b/typo3/sysext/core/Tests/Functional/Fixtures/pages.xml @@ -184,4 +184,35 @@ <sys_language_uid>1</sys_language_uid> <title>Mount translation</title> </pages> + <tt_content> + <uid>1</uid> + <pid>1</pid> + <header>Default Content #1</header> + <bodytext><p>Say thanks for HTML in the DB</p></bodytext> + <sys_language_uid>0</sys_language_uid> + <l18n_parent>0</l18n_parent> + </tt_content> + <tt_content> + <uid>2</uid> + <pid>1</pid> + <header>Translated Content #1</header> + <bodytext><p>Grazie por HTML en la database</p></bodytext> + <sys_language_uid>1</sys_language_uid> + <l18n_parent>1</l18n_parent> + </tt_content> + <tt_content> + <uid>3</uid> + <pid>1</pid> + <header>Default Content #2</header> + <bodytext><p>Could be anything</p></bodytext> + <sys_language_uid>0</sys_language_uid> + <l18n_parent>0</l18n_parent> + </tt_content> + <tt_content> + <uid>4</uid> + <pid>1</pid> + <header>Translated #2</header> + <sys_language_uid>1</sys_language_uid> + <l18n_parent>3</l18n_parent> + </tt_content> </dataset>