sembrouille Posted February 20, 2013 Posted February 20, 2013 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']);
MrPhil Posted February 20, 2013 Posted February 20, 2013 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.
cornishpirate Posted February 21, 2013 Posted February 21, 2013 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
sembrouille Posted February 21, 2013 Author Posted February 21, 2013 Hi Alan, Thank you, it works. in who_online find : $cart replace : $_SESSION['cart']
sembrouille Posted February 21, 2013 Author Posted February 21, 2013 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");
sembrouille Posted February 21, 2013 Author Posted February 21, 2013 @@phil, You're Member of the month, congratulations !
MrPhil Posted February 21, 2013 Posted February 21, 2013 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.
sembrouille Posted February 21, 2013 Author Posted February 21, 2013 "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);
Recommended Posts
Archived
This topic is now archived and is closed to further replies.