Upgrade 4.17.2.SP3 - 4.18.1 error

Please, advise how to fix this error after upgrade to 4.18.1:
DivisionByZeroError

Message
Division by zero

Error at
var/cache/templates/backend/3a40147e7258d50c2e48d7b10ff60543c2668b38_2.tygh.presets.tpl.php, line: 84

Backtrace
File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php
Line:123
Function:content_670e17eac8b200_46420701

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php
Line:114
Function:getRenderedTemplateCode

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
Line:217
Function:render

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
Line:386
Function:render

File:var/cache/templates/backend/1866f165ad644206320400d671de224e4595333b_2.tygh.mainbox.tpl.php
Line:236
Function:_subTemplateRender

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php
Line:123
Function:content_670e17c0a111d7_89421634

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php
Line:114
Function:getRenderedTemplateCode

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
Line:217
Function:render

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
Line:386
Function:render

File:var/cache/templates/backend/f50d1356594b573914020ac9e59cb00074e83187_2.tygh.index.tpl.php
Line:53
Function:_subTemplateRender

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php
Line:123
Function:content_670e17eac62f50_60739403

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php
Line:114
Function:getRenderedTemplateCode

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
Line:217
Function:render

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
Line:386
Function:render

File:var/cache/templates/backend/17733d51616abebe96b267b71bce4c6f33cba410_2.tygh.index.tpl.php
Line:149
Function:_subTemplateRender

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php
Line:123
Function:content_670e17c053a518_33532311

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php
Line:114
Function:getRenderedTemplateCode

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php
Line:217
Function:render

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php
Line:238
Function:render

File:app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php
Line:116
Function:_execute

File:app/Tygh/SmartyEngine/Core.php
Line:81
Function:fetch

File:app/functions/fn.control.php
Line:637
Function:fetch

File:admin.php
Line:21
Function:fn_dispatch

Thank you in advance.

I have changed PHP8.1 to PHP7.4 and upgraded without errors. But if I switch back to PHP8.1, when I click themes in the backend getting the same error above.

Any suggestions, please?
Thank you.

This is a known bug and fortunately, the fix is already included into 4.18.3.

In order to fix this issue in 4.18.1 and 4.18.2, please apply the changes from the attached .diff file.
aa24c62ff74656419f769edfdfc2e361779e47b5.diff (5.4 KB)

2 Likes