Smarty block no longer working after upgrade

I have a simple block with smarty content that uses php ‘file_exists’

After upgrading, it says the block is deprecated and a new one should be created, so I made an identical block with the exact same code, but it no longer works, with this error:

{if is_file($image)}" PHP function ‘is_file’ not allowed by security setting

What security setting is this and where can I change it?

Try to add new custom function to the My changes module (use is_file function inside) and use it in your Smarty block

Unfortunately this is a bit beyond me. I would need the exact specifics of how to do this. :frowning:

I was hoping there was a config file for smarty where I could bypass the security setting?

The other possibility would be to use something other than file_exists, but I have no clue what else I could use.

app → functions-> smarty_plugins maybe?

My site relies on file_exists very heavily on multiple pages. Not having this available anymore is a rather large problem.

OK, so I made a func.php in my_changes with a very simple function and it still won’t allow me, even though I am not using an actual php function:

function fn_custom_image_check($path){
return ‘OK’;
}

PHP function ‘fn_custom_image_check’ not allowed by security setting

How can I get smarty to allow me do anything with php. This is very frustrating!

Hi!

Please refer to this article:
https://docs.cs-cart.com/latest/developer_guide/addons/compatibility/adapting_4152_to_4161.html#html-block-with-smarty-support-is-marked-as-deprecated

You will need to extend the block_manager/smarty_allowed_functions.php schema if you want to allow PHP functions other than those already allowed in Smarty blocks. All responsibility in this case will be on you.

1 Like