Skip to content

[Themes] | Smarty: SVG file includes throw fatal error after re-mapped for Blade file paths #12363

@NateWr

Description

@NateWr

Valid Title

  • I have updated the title to accurately reflect the bug description

Description

In OJS 3.5, it is possible to use the Smarty template syntax to load a .svg file (or a file with any other file extenstion). Example:

{include file="frontend/icons/dropdown.svg"}

In the current main branch, this throws a fatal error:

PHP Fatal error: Uncaught InvalidArgumentException: View [frontend.icons.search.svg] not found.

The problem seems to be related to PKPTemplateManager::smartyPathToViewName(). The file extentions .tpl and .blade are removed before slashes are converted to dots, but the dots remain for other file extensions. I have not tested this, but I believe an error will occur whenever a . appears anywhere in the middle of a filename, such as /frontend/example/article.header.tpl.

I can work around this by renaming my .svg files to .tpl if necessary. However, this may cause problems with other custom themes out there.

Steps to Reproduce

  1. Login as an admin.
  2. Enable the IndividualizeTheme or add {include file="frontend/icons/dropdown.svg"} to any default theme template (like header.tpl).
  3. Activate the theme and load a page on the frontend.
  4. See the error.

Expected Result

The .svg file should load and there should be no fatal error.

Actual Result

Fatal error.

Environment Details

No response

Application Version

main branch (OJS 3.6 pre-release)

Logs

18-Feb-2026 10:41:26 UTC] PHP Fatal error:  Uncaught InvalidArgumentException: View [frontend.icons.search.svg] not found. in /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:139
Stack trace:
#0 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php(79): Illuminate\View\FileViewFinder->findInPaths('frontend.icons....', Array)
#1 /var/www/html/lib/pkp/classes/core/blade/SmartyTemplate.php(80): Illuminate\View\FileViewFinder->find('frontend.icons....')
#2 /var/www/html/cache/t_compile/47ad09e3639800f5166ec8438e65b944d6da7354_0.file.search-input.tpl.php(45): PKP\core\blade\SmartyTemplate->_subTemplateRender('tpl:frontend/ic...', NULL, NULL, 0, 3600, Array, 0, false)
#3 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6995973d7ff3b5_51600042(Object(PKP\core\blade\SmartyTemplate))
#4 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(PKP\core\blade\SmartyTemplate))
#5 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(PKP\core\blade\SmartyTemplate))
#6 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render()
#7 /var/www/html/lib/pkp/classes/core/blade/SmartyTemplate.php(86): Smarty_Internal_Template->_subTemplateRender('file:/var/www/h...', NULL, NULL, 0, 3600, Array, 0, false, NULL, NULL)
#8 /var/www/html/cache/t_compile/60e42335bfb18a295eeaf2eefce3212dfffc3da6_0.file.header-mobile.tpl.php(75): PKP\core\blade\SmartyTemplate->_subTemplateRender('tpl:frontend/co...', NULL, NULL, 0, 3600, Array, 0, false)
#9 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6995973d7fbdc3_96464238(Object(PKP\core\blade\SmartyTemplate))
#10 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(PKP\core\blade\SmartyTemplate))
#11 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(PKP\core\blade\SmartyTemplate))
#12 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render()
#13 /var/www/html/lib/pkp/classes/core/blade/SmartyTemplate.php(86): Smarty_Internal_Template->_subTemplateRender('file:/var/www/h...', NULL, NULL, 0, 3600, Array, 0, false, NULL, NULL)
#14 /var/www/html/cache/t_compile/2ea19b512064574d8e6aeb84e0751864d959d6f0_0.file.layout.tpl.php(59): PKP\core\blade\SmartyTemplate->_subTemplateRender('tpl:frontend/co...', NULL, NULL, 0, 3600, Array, 0, false)
#15 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6995973d7f1e12_86145651(Object(PKP\core\blade\SmartyTemplate))
#16 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(PKP\core\blade\SmartyTemplate))
#17 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(PKP\core\blade\SmartyTemplate))
#18 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render()
#19 /var/www/html/lib/pkp/classes/core/blade/SmartyTemplate.php(86): Smarty_Internal_Template->_subTemplateRender('file:/var/www/h...', NULL, NULL, 0, 3600, Array, 2, false, NULL, NULL)
#20 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php(115): PKP\core\blade\SmartyTemplate->_subTemplateRender('frontend/layout...', NULL, NULL, 0, 3600, Array, 2, false, NULL, NULL)
#21 /var/www/html/cache/t_compile/dd51c86af4f28ef1048b1562ea90a7d58d024a7d_0.file.article.tpl.php(64): Smarty_Internal_Runtime_Inheritance->endChild(Object(PKP\core\blade\SmartyTemplate), 'frontend/layout...')
#22 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6995973d7e4fe7_74442210(Object(PKP\core\blade\SmartyTemplate))
#23 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(PKP\core\blade\SmartyTemplate))
#24 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(PKP\core\blade\SmartyTemplate))
#25 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render(false, 0)
#26 /var/www/html/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute(Object(PKP\core\blade\SmartyTemplate), NULL, NULL, NULL, 0)
#27 /var/www/html/lib/pkp/classes/core/blade/SmartyTemplate.php(37): Smarty_Internal_TemplateBase->fetch(NULL, NULL, NULL, NULL)
#28 /var/www/html/lib/pkp/classes/core/blade/SmartyTemplatingEngine.php(49): PKP\core\blade\SmartyTemplate->fetch()
#29 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/View/View.php(209): PKP\core\blade\SmartyTemplatingEngine->get('/var/www/html/p...', Array)
#30 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/View/View.php(192): Illuminate\View\View->getContents()
#31 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/View/View.php(161): Illuminate\View\View->renderContents()
#32 /var/www/html/lib/pkp/classes/template/PKPTemplateManager.php(1418): Illuminate\View\View->render()
#33 /var/www/html/lib/pkp/classes/template/PKPTemplateManager.php(1713): PKP\template\PKPTemplateManager->fetch('frontend/pages/...', NULL, NULL, NULL)
#34 /var/www/html/pages/article/ArticleHandler.php(410): PKP\template\PKPTemplateManager->display('frontend/pages/...')
#35 [internal function]: APP\pages\article\ArticleHandler->view(Array, Object(APP\core\Request))
#36 /var/www/html/lib/pkp/classes/core/PKPRouter.php(328): call_user_func(Array, Array, Object(APP\core\Request))
#37 /var/www/html/lib/pkp/classes/core/PKPPageRouter.php(249): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array, false)
#38 /var/www/html/lib/pkp/classes/core/Dispatcher.php(157): PKP\core\PKPPageRouter->route(Object(APP\core\Request))
#39 /var/www/html/lib/pkp/classes/core/PKPApplication.php(359): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#40 /var/www/html/index.php(21): PKP\core\PKPApplication->execute()
#41 {main}
  thrown in /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php on line 139

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions