Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Warning: htmlspecialchars() expects parameter 1 to be string


sputnikinternet

Recommended Posts

I've searched the million posts related to this, but can't find a solution. All i've done is move the site to a new server, still mysql 4 though, and i get this at checkout.

 

 

 

Billing Address (Edit)

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /homepages/4/d155525213/htdocs/musthavetoys/includes/functions/general.php on line 42

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /homepages/4/d155525213/htdocs/musthavetoys/includes/functions/general.php on line 42

 

Payment Method (Edit)

Credit/ Debit Card secure online transaction

 

 

There seems to be a fix by hard coding a country, but we need to be international.

 

Any suggestions?

Link to comment
Share on other sites

its probably an array (of countries?) that is passed through from the tep_output_string function. Like from tep_address_format. You shouldn't pass an array in the first place.

Link to comment
Share on other sites

i don't remember changing any of the code since it last worked.

to get the error, i just logged on as an existing user.

 

the site, by the way, is www.musthavetoys.com

 

 

All seems to be working. For some reason, although there were addresses set up for the user account, none were set as "primary address".

 

I changed this for the user, and it all seems to be working.

Link to comment
Share on other sites

  • 7 months later...

thanks for the info it helped solve my problem.

 

i found that as i was just testing my site i'd just quickly type anything into the address and poscode areas. creating new accounts to beta test it, so i went and deleted all the fake acounts/addresses. didn't touch any CODE, and it cleaned up the error.

 

hope that helps someone

 

tim

Link to comment
Share on other sites

  • 1 year later...
thanks for the info it helped solve my problem.

 

i found that as i was just testing my site i'd just quickly type anything into the address and poscode areas. creating new accounts to beta test it, so i went and deleted all the fake acounts/addresses. didn't touch any CODE, and it cleaned up the error.

 

hope that helps someone

 

tim

 

In catalog\includes\functions\general.php find in tep_address_format:

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']);

 

and replace with

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']['title']);

Link to comment
Share on other sites

  • 2 weeks later...

I tried both, removing all the junk accounts & adding the ['title']); vmaster suggested.

I even cleared my browser ~ still goofs up.

 

I installed http://addons.oscommerce.com/info/4691

from patch060817vs2003.txt;

"The file catalog/includes/functions/general.php has not been included in the patch, even it was modified in the 060817 revision, as it is

known to be buggy."

 

My trouble is in my test store - testing authorize.net AIM

 

Everything is running fine on the live store a.net AIM is installed but not yet launched.

 

The test site is MySQL 5.0.27

Live site is MySQL 4.1.22

both are PHP Version: 5.0.5

 

Does anybody know if my problem is just the different mysql? Or if this has anything to do with a.net AIM anyway?

Link to comment
Share on other sites

  • 4 weeks later...
I've searched the million posts related to this, but can't find a solution. All i've done is move the site to a new server, still mysql 4 though, and i get this at checkout.

Billing Address (Edit)

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /homepages/4/d155525213/htdocs/musthavetoys/includes/functions/general.php on line 42

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /homepages/4/d155525213/htdocs/musthavetoys/includes/functions/general.php on line 42

 

Payment Method (Edit)

Credit/ Debit Card secure online transaction

There seems to be a fix by hard coding a country, but we need to be international.

 

Any suggestions?

Don't know about you, but I got this after doing the patches to upgrade to RC1.

 

When I removed the patch [bUGFIX] Country Name on the Order History Page to problem went away.

Link to comment
Share on other sites

I think I found a solution for this problem, I removed today the ['title'] beside the country tag because it helped me to see the whole country name in the account_history_info.php, and not only the first initial.

 

But then I had the problem that I got the same error message, so I changed all ['country_id'] to ['country']['id'], like this:

 

In catalog\includes\functions\general.php find in tep_address_format:

 

if (isset($address['country']['id']) && tep_not_null($address['country']['id'])) {
  $country = tep_get_country_name($address['country']['id']);

  if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {
	$state = tep_get_zone_code($address['country']['id'], $address['zone_id'], $state);
  }
} elseif (isset($address['country']) && tep_not_null($address['country'])) {
  $country = tep_output_string_protected($address['country']);
} else {
  $country = '';
}

 

I hope this could someone help, now my shipping estimator and payment modules are working fine.

Link to comment
Share on other sites

  • 2 years later...

In catalog\includes\functions\general.php find in tep_address_format:

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']);

 

and replace with

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']['title']);

 

Thanks removed htmlspecialchars() error when using reorder addon over a clean rc2a install.

"If it was easy everybody would be doing it"

Link to comment
Share on other sites

  • 4 months later...

In catalog\includes\functions\general.php find in tep_address_format:

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']);

 

and replace with

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']['title']);

----------------------------------------------------------------------------------------------------

That contribution is great. It helped me solving the unpleasent error message on the screen.

Link to comment
Share on other sites

  • 5 months later...

This contribution solve my problem also

 

Though, In additional to above, I had to replace every other entry of

tep_output_string_protected($address['country'])

 

to

 

tep_output_string_protected($address['country']['title'])

Link to comment
Share on other sites

  • 4 months later...

In catalog\includes\functions\general.php find in tep_address_format:

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']);

 

and replace with

 

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']['title']);

thank you this work for me

Link to comment
Share on other sites

  • 1 month later...

hi, this isn't working for me. I'm thinking it might have something to do with the " force country" mod i have installed as i only want to deliver within australia.

 

could someone let me know if they are also using this mod so i can rule it IN or OUT of the problem.

 

thanks

 

tim

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...