Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why do I get this error message in checkout


Mark-UK

Recommended Posts

I get this error in my checkout confirmation page, any ideas please.

 

Billing Address (Edit)

 

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

 

Payment Method (Edit)

PayPal

 

Thanks for the help people. <_<

Link to comment
Share on other sites

Thanks, line 53 in bold.

 

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

Link to comment
Share on other sites

Hmmm,

 

Looks just like the stock code in a fresh install

 

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

 

Have you added any contribs that modify that file before that line? It's line 42 in the stock general.php is why I ask. Scan back and see if you have any open or doubly closed functions before line 53.

 

Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

The problem isn't in the function itself, but the code that is calling it - it is passing an array, where a string is expected (as the error says).

 

Find out which invocation of this function is causing the problem, and try to ascertain the value of the parameter it is passing.

 

in checkout confirmation, this line outputs the billing address, which seems to be the problem.

:

 

<td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>

 

 

if you find tep_address_format() in general php and follow the code there, that might help.

Link to comment
Share on other sites

OK this might be a reason, earlier i had a problem where i had a drop down list with all countres which i didnt need, i was told to delete all countries i dont wnat in admin so i did, just leaving united kingdom.

 

Thing is then I had united kingdon AND united states still in the drop down. I was told to fix this do the following and change united states to united kingdom in the codebelow which i did. BUT i have NOT changed the ID 223 number as i couldnt find one for the united kingdom in my admin, its just got GB and GBR and it needs to be a number yes.

 

Now when i edit my adress and change the united kingdom option to the lower one in the list which is the original united kingdom i dont get that message. Any ideas thanks.

 

// Creates a pull-down list of countries

function tep_get_country_list($name, $selected = '', $parameters = '') {

$countries_array = array(array('id' => '223', 'text' => 'United States'));

$countries = tep_get_countries();

Link to comment
Share on other sites

OK i think ive found the answer or reason, when i go to create account on the site and view source there is a bit where there are 2 united kingdom options and the code for the first one is the US code of 223, now ive looked on every create_account page and cant find it, so i presume if i can remove 1 of the united kingdom options, the one with 223 id ill be fine yes, i just need to know where to locate the correct create_account.php file as ive looked at both and cant find that source anywhere.

Link to comment
Share on other sites

Hi,

 

I fixed this bug.

 

For me it was problem with cookes.

 

Be sure that the url always has session parameter,

 

like "?osCsid=2eb31fbb689899f6c5d5c97dd9172aaf"

 

In configure.php I defined:

 

define('HTTP_COOKIE_DOMAIN', 'localhost');

 

Hope it helps...

 

:rolleyes:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...