Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error messages with {capture} #1032

Open
SlowFox71 opened this issue Jun 12, 2024 · 1 comment
Open

Misleading error messages with {capture} #1032

SlowFox71 opened this issue Jun 12, 2024 · 1 comment

Comments

@SlowFox71
Copy link

If in a template with a {capture} block e.g. a TypError occurs within the content of the block, a misleading error message Not matching {capture}{/capture} in 'file:menuitem.tpl' is created with a backtrace like this:

#0 [...]/smarty-5.0.2/src/Runtime/CaptureRuntime.php(158): Smarty\Runtime\CaptureRuntime->error()
#1 [internal function]: Smarty\Runtime\CaptureRuntime->endRender()
#2 [...]/smarty-5.0.2/src/Template.php(185): call_user_func()
#3 [...]/smarty-5.0.2/src/Template.php(287): Smarty\Template->render()
#4 [...]/smarty_compile/ca/14/77/ca1477d761222a02268be0083d90c89f1842f445_0.file_menu.tpl.php(147): Smarty\Template->renderSubTemplate()
#5 [...]/smarty-5.0.2/src/Template/GeneratedPhpFile.php(111): content_665a28c0dbf522_48026962()
#6 [...]/smarty-5.0.2/src/Template/Compiled.php(110): Smarty\Template\GeneratedPhpFile->getRenderedTemplateCode()
#7 [...]/smarty-5.0.2/src/Template.php(180): Smarty\Template\Compiled->render()
#8 [...]/smarty-5.0.2/src/Template.php(287): Smarty\Template->render()
#9 [...]/smarty_compile/3d/a4/5b/3da45bae079bd02187704c890744779d6127e37f_0.file_page.tpl.php(102): Smarty\Template->renderSubTemplate()
#10 [...]/smarty-5.0.2/src/Template/GeneratedPhpFile.php(111): content_6657a72d813116_59350783()
#11 [...]/smarty-5.0.2/src/Template/Compiled.php(110): Smarty\Template\GeneratedPhpFile->getRenderedTemplateCode()
#12 [...]/smarty-5.0.2/src/Template.php(180): Smarty\Template\Compiled->render()
#13 [...]/smarty-5.0.2/src/Template.php(653): Smarty\Template->render()
#14 [...]/smarty-5.0.2/src/Template.php(586): Smarty\Template->_execute()
#15 [...]/smarty-5.0.2/src/Smarty.php(2122): Smarty\Template->fetch()

It takes some time to realize what really happens and strip the {capture} to get the actual error.
I don't know if it is technically possible, but if yes, wouldn't it be far better to just pass the error (or at least the message) along so the real problem can be identified?

@evio85
Copy link

evio85 commented Oct 6, 2024

Problem still exist. I have to move code from {capture} block, to see what actually happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants