Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Warning: trim() expects parameter 1 to be string


Recommended Posts

Customer purchased an item through my store and reported this error.

Anyone got an idea of the likely root cause (and fix :smile:) is it a temporary blip or something more serious?



Hello After completing my recent order of the SQF Safety management package I was returned to the Store homepage and found this in two locations on the screen:


Warning: trim() expects parameter 1 to be string, array given in /home/xxxxxx/public_html/includes/functions/general.php on line 37


I am not a programmer so I thought you should be informed of this occurence. Thank you and have a great day.



Link to comment
Share on other sites

line 21 to line 60.



// Redirect to another page or site

function tep_redirect($url) {

if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page

if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url

$url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL




header('Location: ' . $url);






// Parse the data used in the html tags to ensure the tags will not break

function tep_parse_input_field_data($data, $parse) {

return strtr(trim($data), $parse);



function tep_output_string($string, $translate = false, $protected = false) {

if ($protected == true) {

return htmlspecialchars($string);

} else {

if ($translate == false) {

return tep_parse_input_field_data($string, array('"' => '"'));

} else {

return tep_parse_input_field_data($string, $translate);





function tep_output_string_protected($string) {

return tep_output_string($string, false, true);



function tep_sanitize_string($string) {

$string = ereg_replace(' +', ' ', trim($string));


return preg_replace("/[<>]/", '_', $string);


Link to comment
Share on other sites

That's the standard oscommerce code so, most likely, that is not the problem. The error is saying the code is being given the wrong kind of data so my guess is that you have entered something in that is confusing it, or you are using an addon that is not coded correctly. You'll need to trace down the source of the problem. For example, if you go to the product page and it fails while displaying the privacy page works fine, then the problem may be on the products page. If it is due to a meta tag entry, take a look at that section in the admin->Modules to see if there is anything html coding being used,

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...