Jump to content

Something went wrong and we couldn't process your request.


Recommended Posts

Hello

 

I am having an issue in the client area, when users select a smartermail service, they get Something went wrong and we couldn't process your request. with this info

Error: Call to a member function getTemplateVars() on null in /var/www/vhosts/billing.wsigenesis.com/whmcsdata/templates_c/6168120062068525cbc19f8fd94a9d6e8c6ab6ae_0.file.clientarea.tpl.php:25
Stack trace:

0 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5ff3743078b550_78353019()
1 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
2 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()
3 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render()
4 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()
5 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/whmcs/whmcs-foundation/lib/Smarty.php(0): Smarty_Internal_TemplateBase->fetch()
6 /var/www/vhosts/billing.wsigenesis.com/httpdocs/vendor/whmcs/whmcs-foundation/lib/ClientArea.php(0): WHMCS\Smarty->fetch()
7 /var/www/vhosts/billing.wsigenesis.com/httpdocs/clientarea.php(0): WHMCS\ClientArea->getSingleTPLOutput()

WHMCS advise:::

 

I have discovered a solution: you can allow the template object in Smarty Security policy as mentioned here:

https://docs.whmcs.com/Smarty_Security_Policy#Supported_Policy_Settings_and_Values

Here is an example of a working policy and template snippet using the $template object instead of getTemplateVars() that demonstrates this

// minimum policy inside configuration.php
$smarty_security_policy = array(
    'system' => array(
        'disabled_tags' => [],
        'enabled_special_smarty_vars' => array(
            'template_object',
        ),
    ),
);

<!-- in the page's template -->
{php}
    echo 'PHP Block: ';
    echo $template->tpl_vars['template'];
    echo "<br/>";
{/php}
Template Variable: {$template}<br/>

I trust that gives you a good starting point for your customisations.

Does any one know where to add the above

 

Thanks

 

Brian

 

Link to comment
Share on other sites

Hello 

For me it was the smartermail server add on  modules/servers/smartermail/smartermail.php  edit this file and locate all lines with getTemplateVars() and comment it out as they do not work anyways since the smartermail code is very dated and there has not been any update for years.

Doing this while the smartermail function will not work, but this is ok, at least the whmcs functions and it will eliminate the errors.

 

Brian

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated