Bug #79760

FLUIDTEMPLATE not rendered when Layout name collides with Layout name of FSC

Added by Riccardo De Contardi over 1 year ago. Updated 5 months ago.

Status:
Resolved
Priority:
Must have
Assignee:
-
Category:
Fluid Styled Content
Target version:
-
Start date:
2017-02-11
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
On Location Sprint

Related issues

Related to TYPO3 Core - Bug #77235: Collision of page template partials having the same name as fluid_styled_content partials Closed 2016-07-24
Related to TYPO3 Core - Bug #81415: Section does not exist exception if extension layout file is named "Default" Closed 2017-06-02
Related to TYPO3 Core - Bug #76675: Layout Filename must be unique or frontend crashes Closed 2016-06-17
Related to TYPO3 Core - Bug #81021: Fatal error in fluid_template with switchableControllerActions, one plugin and a shared layout Closed 2017-04-26
Related to TYPO3 Core - Bug #82338: Wrong Default.html layout file used Closed 2017-09-07
Related to TYPO3 Core - Bug #82889: fluid_styled_content major section bug Closed 2017-10-31

Associated revisions

Revision 5c048a4c (diff)
Added by Benjamin Franzke 7 months ago

[BUGFIX] Fix recursive FLUIDTEMPLATE cObj's that use layoutRootPaths

FLUIDTEMPLATE variables may contain content elements (e.g. recursive
FLUIDTEMPLATE's) which may instantiate own TemplateViews
(e.g. StandaloneView).
A recursive StandaloneView will statically(!!) cache used TemplatesPaths
in \TYPO3Fluid\Fluid\View\Templates::resolvedFiles.

If StandaloneView is instantiated before, but the fluid layout path is
calculated after inner content objects are being rendering,
the altered statically cached `resolvedFiles` cache is used
and contains invalid layoutRootPaths.

Short term solution:
Defer the initialization of the StandaloneView (which flushes those
buggy caches) until all variables have been processed.

Change-Id: Idf053b3d0f0835a352790e0ed971344d67844bbc
Releases: master, 8.7
Resolves: #79760
Resolves: #82745
Reviewed-on: https://review.typo3.org/54416
Tested-by: TYPO3com <>
Reviewed-by: Sebastian Hofer <>
Tested-by: Sebastian Hofer <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>

Revision dbf5f643 (diff)
Added by Benjamin Franzke 6 months ago

[BUGFIX] Fix recursive FLUIDTEMPLATE cObj's that use layoutRootPaths

FLUIDTEMPLATE variables may contain content elements (e.g. recursive
FLUIDTEMPLATE's) which may instantiate own TemplateViews
(e.g. StandaloneView).
A recursive StandaloneView will statically(!!) cache used TemplatesPaths
in \TYPO3Fluid\Fluid\View\Templates::resolvedFiles.

If StandaloneView is instantiated before, but the fluid layout path is
calculated after inner content objects are being rendering,
the altered statically cached `resolvedFiles` cache is used
and contains invalid layoutRootPaths.

Short term solution:
Defer the initialization of the StandaloneView (which flushes those
buggy caches) until all variables have been processed.

Change-Id: Idf053b3d0f0835a352790e0ed971344d67844bbc
Releases: master, 8.7
Resolves: #79760
Resolves: #82745
Reviewed-on: https://review.typo3.org/55252
Tested-by: TYPO3com <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>

History

#1 Updated by Riccardo De Contardi over 1 year ago

These steps should be sufficient to reproduce on the latest master:
1) Enable and load FSC
2) TS Setup:

page=PAGE
page.10 = FLUIDTEMPLATE
page.10 {
  templateName = Default
  layoutRootPaths {
          10 = fileadmin/Layouts
   }
  partialRootPaths {
          10 = fileadmin/Partials
  }
  templateRootPaths {
          10 = fileadmin/Templates
  }
}

3) put a Default.html inside /fileadmin/Templates/ with the following content:

<f:layout name="Default" />
<f:section name="content">
<h1>hello world</h1>
</f:section>

4) put a file Default.html inside /fileadmin/Layouts/ with the following content

<f:render section="content" />

5) Result: the page.10 object is ignored and instead you get inside the page:

<div id="c1" class="frame frame- frame-type- frame-layout-1"></div>

where the "c1" has the page ID

If you change the layout name (e.g. "Index.html") and the related <f:layout name="Index" /> everything works again.

#2 Updated by Riccardo De Contardi over 1 year ago

UPDATE

1) to reproduce the issue, you must have a configuration like this one:

page.10 = FLUIDTEMPLATE
page.10 {
  templateName = Default
  layoutRootPaths {
          10 = fileadmin/Layouts
   }
  partialRootPaths {
          10 = fileadmin/Partials
  }
  templateRootPaths {
          10 = fileadmin/Templates
  }
  variables {
   maincontent < styles.content.get
  }
}

2) If you use a subfolder as repository for the Layouts, e.g.

  partialRootPaths {
          10 = fileadmin/Layouts/Page

the issue is still present

3) The Default.html of FSC is taken instead of that inside fileadmin/Layouts/Page: if you modify the template:

<f:layout name="Default" />
<f:section name="Main">
<h1>hello world</h1>
</f:section>

you are able to see the content, but you are using the Default.html layout file of FSC: you can even still keep the layout with the wrong section name:

<f:render section="content" />

4) the responsible of the issue is the variable maincontent < styles.content.get
If you remove that line, and use instead:

 lib.content = < styles.content.get

in combination with <f:cObject typoscriptObjectPath="lib.content" />, everything works fine

#3 Updated by Armin Vieweg over 1 year ago

I'm using this configuration:

lib.templates.base.file.stdWrap.cObject = CASE
lib.templates.base.file.stdWrap.cObject {
    key.field = backend_layout
    key.ifEmpty.data = levelfield : -1 , backend_layout_next_level, slide

    default = TEXT
    default.value = EXT:project/Templates/BackendLayouts/Default.html

    pagets__Home = TEXT
    pagets__Home.value = EXT:project/Templates/BackendLayouts/Home.html
}

And currently (8.6) I get no output in styles.content.get when fluid_styled_content is included to template. CSS Styled Content works.
Most likely related to this topic?

#4 Updated by Markus Klein over 1 year ago

@Armin: Your are running into https://forge.typo3.org/issues/80044

#5 Updated by Andre Koller over 1 year ago

I got also no output.

After applying this Patch https://forge.typo3.org/issues/80044

and renaming layout name "Default" it works.

#6 Updated by Markus Klein over 1 year ago

  • Status changed from New to Accepted
  • Target version set to 8 LTS
  • Is Regression changed from No to Yes
  • Sprint Focus set to Stabilization Sprint

#7 Updated by Patrick Broens over 1 year ago

Are you sure this is against latest master?

I don't get it that the FLUIDTEMPLATE declared in page.10 is inheriting stuff from FSC.

#8 Updated by Patrick Broens over 1 year ago

I've just tried to reproduce this. New installation on master, with only the TS as mentioned and the template and layout file. FSC installed.

Cannot reproduce this. Body content is as expected.

<h1>hello world</h1>

#9 Updated by Patrick Broens over 1 year ago

Looking at your first TS setup, there is an error

page=PAGE
page.10 = FLUIDTEMPLATE
lib.stdcontent {
  templateName = Default
  layoutRootPaths {
          10 = fileadmin/Layouts
   }
  partialRootPaths {
          10 = fileadmin/Partials
  }
  templateRootPaths {
          10 = fileadmin/Templates
  }
}

lib.stdcontent should be page.10. But with that error I can't explain why something is rendering at all

#10 Updated by Markus Klein over 1 year ago

  • Status changed from Accepted to Needs Feedback
  • Assignee deleted (Benni Mack)
  • Target version deleted (8 LTS)
  • Is Regression changed from Yes to No

#11 Updated by Riccardo De Contardi over 1 year ago

  • Status changed from Needs Feedback to Accepted

Yes, you are right, I did a wrong cut and paste. The original lines were:

lib.stdcontent = FLUIDTEMPLATE
...
page.10 < lib.stdcontent

I have updated the issue comment n° 1

#12 Updated by Wolfgang Wagner about 1 year ago

Exact the same problem still in 8.7.1 with this code:

page.10 = FLUIDTEMPLATE
page.10 {
    layoutRootPath = EXT:myext/Resources/Private/Layouts/
    partialRootPath = EXT:myext/Resources/Private/Partials/

    file = EXT:myext/Resources/Private/Templates/Default.html

I had a layout file in Resources/Private/Layouts/Default.html

Renaming it to Standard.html (or something else) solved it.

#13 Updated by taywa gmbh about 1 year ago

Same here, took me hours!

I think this is a common problem upgrading from 7 LTS, because examples on the web using <f:layout name="Default" />.

#14 Updated by Michael Binder about 1 year ago

yes, same here.

Renaming the file solved the Problem.

#15 Updated by Daniel Corn about 1 year ago

  • Related to Bug #81415: Section does not exist exception if extension layout file is named "Default" added

#16 Updated by Jan Kiesewetter about 1 year ago

I can confirm this problem.
I think this is a caching issue.
Just one Fluid layout from StandaloneView per filename is cached as a php file to typo3temp/var/Cache/Code/fluid_template/layout_Default_xxx.php
This cached layout is used for every FLUIDTEMPLATE / StandaloneView.

#17 Updated by Florian Gaa about 1 year ago

This Issue is also affecting partials in my case. Naming a partial for example ../Partials/Header/Header.html (same as fsc names it) results in no output of the selfmade partial.

#18 Updated by Sven Teuber 12 months ago

I can confirm the issue and the "fix" of renaming own Layout files to something other than Default.html on TYPO3 8.7.1 & 8.7.2

#19 Updated by Tobias Gaertner 10 months ago

Same here TYPO3 8.7.4
Renaming Layout "Default" to "Main" solved it.

PROBLEM is even the ExtensionBuilder creates Layout called "Default"...and I think I followed this "convention" in all projects...and all of us do ;-)

Since it will appear also with other names like naming a partial "Header" will cause the same problem - this should be fixed!!

#20 Updated by Daniel Corn 10 months ago

Dear TYPO3 Core team! Can you give us a bit of an insight if somebody is working on this issue?

#21 Updated by Clemens Riccabona 9 months ago

  • Related to Bug #76675: Layout Filename must be unique or frontend crashes added

#22 Updated by Clemens Riccabona 9 months ago

  • Related to Bug #81021: Fatal error in fluid_template with switchableControllerActions, one plugin and a shared layout added

#23 Updated by Clemens Riccabona 9 months ago

It seems, there are a couple of related bug-reports, some with the 'magic words' Template-name Default.html. I also found people having troubles on german-speaking forums.
e.g. https://webdesign-forum.net/thread-4176-post-18883.html
and https://www.typo3.net/forum/thematik/zeige/kategorie/linux-unix/thema/126195/

#24 Updated by Gerrit Code Review 8 months ago

  • Status changed from Accepted to Under Review

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/54416

#25 Updated by Bernhard Eckl 8 months ago

  • Related to Bug #82338: Wrong Default.html layout file used added

#26 Updated by Christian Wellinghorst 8 months ago

Patch works in my situation (https://forge.typo3.org/issues/82889), which should be the same problem as described here.

#27 Updated by Mona Muzaffar 7 months ago

  • Related to Bug #82889: fluid_styled_content major section bug added

#28 Updated by Benni Mack 7 months ago

  • Sprint Focus changed from Stabilization Sprint to On Location Sprint

#29 Updated by Benjamin Franzke 7 months ago

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

#30 Updated by Gerrit Code Review 6 months ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55252

#31 Updated by Gerrit Code Review 6 months ago

Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55252

#32 Updated by Benjamin Franzke 6 months ago

  • Status changed from Under Review to Resolved

#33 Updated by Kurt Gusbeth 5 months ago

  • PHP Version changed from 7.0 to 7.1

This bug is not fixed yet. I am getting this error with TYPO3 8.7.9:
Fatal error: Cannot declare class layout_default_7c967e45e97a37c67a007855084550c92e894ba4, because the name is already in use in /xxx/typo3temp/var/Cache/Code/fluid_template/layout_default_7c967e45e97a37c67a007855084550c92e894ba4.php on line 0

Renaming the layout file from default.html to Somethingelse.html solves the problem for me. Now I get this error:
#1225709595: The Fluid template files "/xxx/fileadmin/bsdist/theme/tmpl/backend_layout/Partials/Header.html", "/xxx/fileadmin/bsdist/theme/tmpl/backend_layout/Partials/Header" could not be loaded.

There were no problems with TYPO3 7 LTS.

#34 Updated by Jacob Rasmussen 5 months ago

TYPO3 8.7.9 was released in December, whereas this bug was fixed a week ago, so if you want to test whether or not the issue have been fixed, you need to fetch the TYPO3 8-7 branch from git or wait until the next patch release - which according to the roadmap should be released on the 6th of february.
https://typo3.org/news/article/typo3-release-improvements-v8-maintenance-release-schedule/

#35 Updated by Kurt Gusbeth 5 months ago

OK, the patch worked for me.
And renaming the partial header.html to Header.html worked for me too.

Also available in: Atom PDF