Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

upgrading to php 5.5


John P

Recommended Posts

Our ISP recently upgraded the server from php 5.4 to 5.5 and 5.6 optional.

 

I run OSC 2.3.4

 

php 5.6

specialcharacters are shown incorrectly, so I decided to upgrade to 5.5 first.

 

php 5.5

specialcharacters are shown correctly in the website. I found that the confirmation emails was not or wrongly encoded, not digesting the german umlauts properly.

 

The fix for this I found is:

 

checkout_process.php

 

look for:

 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

 

change to:

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, html_entity_decode($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
  if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, html_entity_decode($email_order), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

Basically the data info from the database will be decoded through htnl_entity_decode($email_order)

 

Do change this is also in your other payment modules that initiate email confirmation.

 

 

Link to comment
Share on other sites

I'm not yet on php 5.5 but tidying up my conversion to UTF-8.

I found that there are different defaults for charactersets between php 5.5 and 5.6 as mentioned on php.net for the html_entity_decode function.

As such, to be safe, you should really add the encoding argument I think.

 

 


encoding

An optional argument defining the encoding used when converting characters.

If omitted, the default value of the encoding varies depending on the PHP version in use. In PHP 5.6 and later, the default_charset configuration option is used as the default value. PHP 5.4 and 5.5 will use UTF-8 as the default. Earlier versions of PHP use ISO-8859-1.

Although this argument is technically optional, you are highly encouraged to specify the correct value for your code if you are using PHP 5.5 or earlier, or if your default_charset configuration option may be set incorrectly for the given input.

 

Did you convert your language files to UTF8 (no bom) format ?

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Yes languages files are converted to uft8, also database is uft8. After updating to php 5.5 the website was displaying the right characters, only the confirmation email was incorrect. I found that text from the languages files were displayed ok, but the text from the database were a bit rubbish. So this html_entity_decode function did the job.

 

I've tried adding utf-8 as second argument, it didn't workout.

html_entity_decode($email_order, 'utf-8')

html_entity_decode($email_order, "utf-8")

Link to comment
Share on other sites

Yes languages files are converted to uft8, also database is uft8. After updating to php 5.5 the website was displaying the right characters, only the confirmation email was incorrect. I found that text from the languages files were displayed ok, but the text from the database were a bit rubbish. So this html_entity_decode function did the job.

 

I've tried adding utf-8 as second argument, it didn't workout.

html_entity_decode($email_order, 'utf-8')

html_entity_decode($email_order, "utf-8")

read the php.net doc on the function, you have to specify another 2nd parameter first

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...