Jump to content

Warning: htmlspecialchars()


Siglo99

Recommended Posts


Hello friends

 

This problem has troubled me for a long time,Find a solution

 

Please guide me to understand people, to solve the following errors


 

PHP Warning:  htmlspecialchars() expects parameter 1 to be string, array given in /home/mayorist/public_html/tools/smarty/plugins/modifier.escape.php on line 40

 

thank you all

 

Link to comment
Share on other sites

Hello,

 

htmlspecialchars function require only string parameter. The syntax is: htmlspecialchars(string,flags,character-set,double_encode)

 

For example:

 

$string = 'My name is John';

echo htmlspecialchars($string);

 

If your $string variable is an array, you get the error like in your post.

Link to comment
Share on other sites

  • 2 years later...
  • 6 months later...

Back to back:

I made an admin controller and the respective class and db table.

The field was NOT an array or object BUT:
In the constructor I took the same field (let's name it "field") and started an object without noticing that they do share the same name.

My bad :( 

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...