Jump to content

PHP Warning: htmlspecialchars() expects parameter 1 to be string, cache error


Sasiadek

Recommended Posts

Hello,

I am facing for a long time with 2 errors:

(I found similar problem, but there issue was with price, i have other problem).

[10-Mar-2023 09:54:49 Europe/Warsaw] PHP Warning:  htmlspecialchars() expects parameter 1 to be string, array given in /home/kf/public_html/var/cache/prod/smarty/compile/laber_alto_home1layouts_layout_left_column_tpl/1f/f7/03/1ff703a048d7e0a4004142706357b869693c6ba4_2.file.productList.tpl.php on line 34

My 1ff703a048d7e0a4004142706357b869693c6ba4_2.file.productList.tpl.php, and line 34 is:

  <?php if ((isset($_smarty_tpl->tpl_vars['position']->value))) {?><meta itemprop="position" content="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['position']->value, ENT_QUOTES, 'UTF-8');?>

 

and second:

[09-Mar-2023 12:02:59 Europe/Warsaw] PHP Warning:  htmlspecialchars() expects parameter 1 to be string, array given in /home/kf/public_html/var/cache/prod/smarty/compile/laber_alto_home1layouts_layout_left_column_tpl/7f/dc/38/7fdc38e08b0cbe3bc91a93dbddeb372b79a24aba_2.file.productGrid.tpl.php on line 44

line 44 in 7fdc38e08b0cbe3bc91a93dbddeb372b79a24aba_2.file.productGrid.tpl.php:

<?php if ((isset($_smarty_tpl->tpl_vars['position']->value))) {?><meta itemprop="position" content="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['position']->value, ENT_QUOTES, 'UTF-8');?>

 

Please can you help me?

maybe somebody had the same problem ???

 

Link to comment
Share on other sites

Hello,
The warning means that the first parameter is an array instead of a string. 
You can try to dump the value of this variable to see what it looks like: 
{$_smarty_tpl->tpl_vars['position']->value|dump}
or on PS 1.6
{$_smarty_tpl->tpl_vars['position']->value|var_dump}
Also, these are cache files, and you probably need to solve the issue in the original files, so try to turn off and delete the smarty cache and check the errors in the original, not cached, tpl files.
I hope that I could help.
Have a nice day, Leo.

Link to comment
Share on other sites

Hello,

Thank you for your request.

i am sorry to ask so stupid question, but how i can

21 hours ago, Prestachamps said:

 dump the value of this variable to see what it looks like: 
{$_smarty_tpl->tpl_vars['position']->value|dump}
 

?

I am working on Presta 1.7.7.5

Thank you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...