cupcakes Posted March 23, 2014 Share Posted March 23, 2014 Not sure why I get this warning. Sure it's not visible when I don't have dev mode on, but still wonder what it is. Anyone know? Warning: trim() expects parameter 1 to be string, array given in /storage/content/21/104221/website.se/public_html/classes/Tools.php on line 1144 Link to comment Share on other sites More sharing options...
Itinerant Posted April 6, 2014 Share Posted April 6, 2014 I have the same problem! Anyone solved that? Link to comment Share on other sites More sharing options...
adanex Posted April 7, 2014 Share Posted April 7, 2014 i have too same problem Link to comment Share on other sites More sharing options...
El Patron Posted April 7, 2014 Share Posted April 7, 2014 is the front/back office working without issue? if so turn off errors, note errors should not be turned on unless you are debugging an issue. A warning does not stop the script from running. Link to comment Share on other sites More sharing options...
Itinerant Posted April 7, 2014 Share Posted April 7, 2014 is the front/back office working without issue? if so turn off errors, note errors should not be turned on unless you are debugging an issue. A warning does not stop the script from running. Warning appears in FO only, about 40 times in a row. It's obvious that warning doesn't stop script. But it shouldn't be there. Warning appears in a function that generates sef url from a string. I don't know where it gets that string from and how this can affect my links! (But I didn't find any broken link on a page yet.) One more strange thing. This warning appears also in product "quick view" window just as many times as on usual pages. This window simply doesn't need so many links to be generated! Link to comment Share on other sites More sharing options...
bellini13 Posted April 7, 2014 Share Posted April 7, 2014 (edited) The code in question is ... $str = trim($str); The variable $str needs to be defined as a String type, but instead it is an Array. $str is passed as a parameter, so to properly fix the issue, you would have to locate the calling function and ensure a String is passed, not an array. This could be a module you are using, or core Prestashop code. There is not enough information to determine this. Otherwise you could change the Tools class to enforce that it is a String, and exit if it is not. Change the above code to the following, which says "if it is not a string, then return the original value". The value will not be 'trimmed'. if (!is_string($str)) return $str; Edited April 7, 2014 by bellini13 (see edit history) 3 Link to comment Share on other sites More sharing options...
bteo Posted November 5, 2014 Share Posted November 5, 2014 if (!is_string($str)) return $str; just wanted to thank bellini13 for posting that fix since no one mentioned if it worked or not I can say it does. my log file was 1GB in size in 1 day before I found out what was happening. Link to comment Share on other sites More sharing options...
Recommended Posts