Project

General

Profile

Actions

Bug #102939

open

Unable to identify fluid template file from exception stack trace

Added by Christian Weiske 10 months ago. Updated 10 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2024-01-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

During development I got an exception in a fluid template, but the exception stack trace is totally useless for determining which fluid template is causing the problem.

The beginning is this (rest of the trace is in the attachment trace2.txt):

(1/1) #1351584844 TYPO3Fluid\Fluid\Core\ViewHelper\Exception
An argument "key" or "id" has to be provided
   in /var/www/typo3/vendor/typo3/cms-fluid/Classes/ViewHelpers/TranslateViewHelper.php line 150
at TYPO3\CMS\Fluid\ViewHelpers\TranslateViewHelper::renderStatic()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/Traits/CompileWithRenderStatic.php line 31
at TYPO3\CMS\Fluid\ViewHelpers\TranslateViewHelper->render()
at call_user_func()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 256
at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->callRenderMethod()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 244
at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->initializeArgumentsAndRender()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/ViewHelper/ViewHelperInvoker.php line 79
at TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInvoker->invoke()
   in /var/www/typo3/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/ViewHelperNode.php line 135

This goes on and on for 161 .php files, not nowhere is the actual fluid template file mentioned that causes it.

Please make exception stack traces more useful for debugging fluid templates.


Files

trace2.txt (28.1 KB) trace2.txt Christian Weiske, 2024-01-26 10:11
Actions #1

Updated by Chris Müller 10 months ago

  • Category set to Fluid
Actions #2

Updated by Christian Kuhn 10 months ago · Edited

Quick hack: This is more easy to see when you reload, since it will then trigger rendering from within the 'compiled' template file, and you can determine the actual template from that filename rather easily.

AND we cleaned up those template files a lot with recent fluid standalone releases, so it is relatively easy to match that to the exact spot in the template (tipp: use "Code" -> "Reformat Code" in phpstorm to get the file into a relatively well nested form, which reduces mental load mapping a specific place in that file to the template even more).

Actions #3

Updated by Christian Kuhn 10 months ago · Edited

How to really change it? I have no idea ... template files are of course not executed as such, and i think there is currently no direct place where the filename is hand over to a method in the backtrace.

What I planned to do in fluid at some point is that the template file cache is always created first, and always executed directly, not only with the second call and beyond. fluid standalone does not do this, since it may run without caches, too. I already thought about requiring a working cache system to always execute the "PHP-form" of templates ... but that's a bit more work and we need to have a look at the impact in fluid standalone before doing this.

Actions

Also available in: Atom PDF