Fatal error in fluid_template with switchableControllerActions, one plugin and a shared layout
I am porting and old extension to 8.7.1 and came across this problem:
A very simple extension: One controller, two actions.
Both actions have their own fluid template, both share the layout "Resources/Private/Layouts/Default.html"
One registered plugin called "Main" and switchableControllerActions in a Flexform to make both actions selectable for the editors.
Everything is fine when I use the plugin on a single page only once.
As soon as I add the plugin a second time (with another action or even the same action selected) I get the following error on the page in the frontend:
Fatal error: Cannot declare class layout_default_ca646fe3088961927af32c308d5f12419c385887, because the name is already in use in /srv/www/public/sites/customer01/web/typo3temp/var/Cache/Code/fluid_template/layout_default_ca646fe3088961927af32c308d5f12419c385887.php on line 0
The error is gone upon first reload after clearing the cache and it comes back with the second reload.
So far I can only "fix" it by disabling the second plugin or by duplicating the layout file and setting the layout of the second action to the new layout file so that the actions don't share the same layout file.
Server: Apache/2.4.7 (Ubuntu)
TYPO3 is currently running in production context.
If you need any more information, just ask.
Updated by Philipp Idler about 4 years ago
I had a similar issue today and found a solution.
In former TYPO3 versions (< 8) you could declare your layout as "Default.html" and use it in your template with <f:layout name="default"/> (no case sensitive!).
Since TYPO3 8 the layout name is case sensitive, so check your templates and change your layout name to match the convention: <f:layout name="Default"/>
Please provide some feedback if it fixes your issue.