miless Posted June 29, 2009 Share Posted June 29, 2009 I'm trying to htmlentities all the $_POSTs in my script (must be around 50) but I get this warning. The code works as intended but a warning appears if you set error reporting. Any idea how to fix it so there is no warning? error_reporting(E_ALL | E_STRICT); Warning: htmlentities() expects parameter 1 to be string, array given in /path-to-file on line XX $_POST = array_map("htmlentities", $_POST); Quote Link to comment https://forums.phpfreaks.com/topic/164157-solved-htmlentities-and-array_map/ Share on other sites More sharing options...
.josh Posted June 29, 2009 Share Posted June 29, 2009 is your $_POST array multi-dim? Like for instance, using someVar[] in your form? Quote Link to comment https://forums.phpfreaks.com/topic/164157-solved-htmlentities-and-array_map/#findComment-865967 Share on other sites More sharing options...
miless Posted June 30, 2009 Author Share Posted June 30, 2009 You're right. The second element on the $_POST array ($_POST[1]) was an array. Did not realize that [1] is the second in the array not the first. Oops. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/164157-solved-htmlentities-and-array_map/#findComment-866216 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.