Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bug with php 5.4.6


sembrouille

Recommended Posts

Posted

I found 2 bugs with php 5.4.6:

 

1) In admin/whos_online.php : Difference between session and display cart.

When I click on row, the basket does not display, and when I click on another row it display the basket of the first row.

 

2) htmlspecialchars does not display the names from the db with accents such as htmlspecialchars($order['CUSTOMER_NAME']);

Posted

2) htmlspecialchars() changed with PHP 5.4. If the encoding is not explicitly given, it is now expected to be a valid UTF-8 stream. Up through PHP 5.3 the default was Latin-1. I suspect that you're going to have to go around all the places where htmlspecialchars() are used and add the encoding argument if necessary. See http://www.php.net/manual/en/function.htmlspecialchars.php and http://www.php.net/manual/en/function.htmlentities.php.

Posted

I had this problem with whos_online when I moved to PHP 5.4 on my XAMPP development server.

 

I seem to remember that it was a register globals issue which I solved by adding

 

$cart = $_SESSION['cart'];

 

where the test for the PHP version is made.

 

Give it a try....

 

Alan

Posted

Hi Phil,

 

Thank you, it works.

 

For "ISO-8859-1", in includes/functions/general.php

 

find :

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

if ($protected == true) {

return htmlspecialchars($string);

 

replace :

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

if ($protected == true) {

return htmlspecialchars($string, ENT_QUOTES, "ISO-8859-1");

Posted

Thanks. 7 more days of fame and fortune, then back to the salt mines...

 

Be careful if you choose to hard code the encoding rather than using a global encoding variable (is there one in your version of osC?). If you change your store encoding later, don't forget to update any patches that hard code it to Latin-1.

Posted

"Be careful if you choose to hard code the encoding"

 

exact, we have the same idea, I changed the code to work for all osc version :

 

in includes/functions/general.php

 

find :

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

if ($protected == true) {

return htmlspecialchars($string);

 

replace :

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

if ($protected == true) {

return htmlspecialchars($string, ENT_QUOTES, CHARSET);

Archived

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

×
×
  • Create New...