Bug #87093

TYPO3 9.5: CONTENT TypoScript object type does not select records with language set to -1

Added by Manfred Egger 9 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2018-12-06
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If you create tt_contents with language set to "All" aka -1 then those records are only shown in foreign languages. In the default language (sys_language_uid = 0) they are not shown.
It seems that in ContentObjectRenderer->getQueryConstraints the constraint "AND (tt_content.sys_language_uid in (0,-1))" is only added, if the same page is opened in other languages. In the default language it's always "AND (tt_content.sys_language_uid = 0)". In TYPO3 8.5 the expected constraint is also added in the default language.
The problem is, that in ContentObjectRenderer->getQueryConstraints the LanguageAspect's doOverlays() method is queried, and this only return true if sys_language_uid is greater 0.
For me the solution is to change the else part on line 6936 (TYPO3 9.5.1) in ContentObjectRenderer.php from

$languageQuery = $expressionBuilder->eq($languageField, $languageAspect->getContentId());

to

$languageQuery = $expressionBuilder->in($languageField, [$languageAspect->getContentId(), -1]);

but I don't know if there are any unexpected side effects.

Side note: I also made some other tests and for me extbase records and even the RECORD TypoScript object works as expected. I think only CONTENT TypoScript object and code parts which depends on ContentObjectRenderer->getQueryConstraints are affected.


Related issues

Related to TYPO3 Core - Bug #87950: No language fallback Closed 2019-03-19
Duplicated by TYPO3 Core - Bug #87749: content elements with language "all languages -1" not working in default language Closed 2019-02-20

Associated revisions

Revision 0dd23086 (diff)
Added by Benni Mack 5 months ago

[BUGFIX] Include Records with "All Languages" in default language

Records with "All Languages" (sys_language_uid=-1)
aren't shown in TYPO3 v9 anymore of the default
language.

This happened before in TYPO3 v8 and below,
however setting config.sys_language_overlay = 1
triggered the if() condition to jump into the
selection of fetching 0 and -1 records.

As this setting is removed, the check only
applies when overlays are activated, which
is not necessary in language=0.

Resolves: #86972
Resolves: #87749
Resolves: #87093
Releases: master, 9.5
Change-Id: I9308167aede071125df02b848a26283e3f77b759
Reviewed-on: https://review.typo3.org/c/59993
Tested-by: TYPO3com <>
Tested-by: Georg Ringer <>
Tested-by: Susanne Moog <>
Tested-by: Benni Mack <>
Reviewed-by: Georg Ringer <>
Reviewed-by: Susanne Moog <>
Reviewed-by: Benni Mack <>

Revision 4d289472 (diff)
Added by Benni Mack 5 months ago

[BUGFIX] Include Records with "All Languages" in default language

Records with "All Languages" (sys_language_uid=-1)
aren't shown in TYPO3 v9 anymore of the default
language.

This happened before in TYPO3 v8 and below,
however setting config.sys_language_overlay = 1
triggered the if() condition to jump into the
selection of fetching 0 and -1 records.

As this setting is removed, the check only
applies when overlays are activated, which
is not necessary in language=0.

Resolves: #86972
Resolves: #87749
Resolves: #87093
Releases: master, 9.5
Change-Id: I9308167aede071125df02b848a26283e3f77b759
Reviewed-on: https://review.typo3.org/c/60192
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Manfred Egger 8 months ago

  • Subject changed from CONTENT TypoScript object type does not select records with language set to -1 to TYPO3 9.5: CONTENT TypoScript object type does not select records with language set to -1

#2 Updated by Attila Glück 7 months ago

I can confirm this issue

#3 Updated by Martin Weymayer 6 months ago

I can confirm this issue too

#4 Updated by Martin Weymayer 6 months ago

@Manfred Egger: did you find any unexpected side effects or is you fix working fine?

#5 Updated by Manfred Egger 6 months ago

@Martin Weymayer: I didn't test all possibilities, but for my installations the fix is working fine.

#6 Updated by Martin Weymayer 6 months ago

thanks for info!

#7 Updated by Manfred Egger 6 months ago

  • Duplicated by Bug #87749: content elements with language "all languages -1" not working in default language added

#8 Updated by Gerrit Code Review 6 months ago

  • Status changed from New to Under Review

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/c/Packages/TYPO3.CMS/+/59993

#9 Updated by Gerrit Code Review 5 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60192

#10 Updated by Benni Mack 5 months ago

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

#11 Updated by Benni Mack 5 months ago

  • Related to Bug #87950: No language fallback added

#12 Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF