Page 1 of 1

general.php coding trouble install for SSL

Posted: Sat Apr 19, 2008 8:09 pm
by MichelleD
Need help with code for general.php file.

I get this warning on my confirmation page of checkout for my site.

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/username/public_html/store/includes/functions/general.php on line 42

I have installed SSL dedicated certificate to osCommerce setup/dedicated server. I edited the files for Includes-configure.php and Admin-Includes-configure.php. My site shows the https:// in the URL address and the lock shows at the bottom of the IE browser. Everything seems to work accept for this error message on the confirmation checkout page.

Do I need to assign something to the following code? What in the following area of code in the general.php file needs to be changed for the SSL certificate to work?

Thanks


<?php
/*
$Id: general.php,v 1.231 2003/07/09 01:15:48 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

////
// Stop from parsing any further PHP code
function tep_exit() {
tep_session_close();
exit();
}

////
// 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);

tep_exit();
}

////
// 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);
}

Re: general.php coding trouble install for SSL

Posted: Sat Apr 19, 2008 9:10 pm
by flying_circus
You need to find out what is calling this function:

Code: Select all

 
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);
    }
  }
}
 
Whatever it is, passed an array value where this function is expecting a string, and this function didnt check the data type.

find out what is calling tep_output_string and you should find your culprit