Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP 5.4 Compatibility Fix (coming in v2.3.3)


Recommended Posts

Hi All..

 

A PHP 5.4 compatibility fix will be included in v2.3.3 to make v2.3.x work under PHP 5.4 installations. The simple fix, which is not PHP 5.4 specific but rather a general bug fix, can be seen at:

 

https://github.com/osCommerce/oscommerce2/commit/9a4d1e6ab9ed87bdc20543995448b114364426b9

 

This should not have an affect on Add-Ons. If an Add-On is affected, it will be noted similar to what has been done for the v2.3.2 upgrade guide.

 

Kind regards,

:heart:, osCommerce

Link to comment
Share on other sites

Hi @@Harald Ponce de Leon

 

what will be the new in v2.3.3 beyond the php5.4 fixes and could you let us know about it? I think exept only some exclusive contributions not need to rewrites so it will be a big project in the future. PHP5.4 fixes wont be stop in the core for community. Do not you afraid of too many brain resources will be need on it and the v3 will be stop for a while which really use PHP5.4 abilities?

 

 

Regards,

Gergely

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Link to comment
Share on other sites

For PHP5.4 would it not also make sense to do this small change in the tep_session_is_registered function?

 

return isset($_SESSION) && array_key_exists($variable, $_SESSION);

 

to

 

return isset($_SESSION[$variable]) && array_key_exists($variable, $_SESSION);
Link to comment
Share on other sites

Hi Tóth..

 

what will be the new in v2.3.3 beyond the php5.4 fixes and could you let us know about it? I think exept only some exclusive contributions not need to rewrites so it will be a big project in the future. PHP5.4 fixes wont be stop in the core for community. Do not you afraid of too many brain resources will be need on it and the v3 will be stop for a while which really use PHP5.4 abilities?

 

 

A list of changes so far confirmed for v2.3.3 can be seen here:

 

https://github.com/osCommerce/oscommerce2/compare/master...upgrade233#files_bucket

 

After v3.1 (user ready release) replaces v3.0, we can look at a v3.2 development branch for optimizing to PHP 5.4, possibly even PHP 5.5:

 

http://nikic.github.com/2012/07/10/What-PHP-5-5-might-look-like.html

 

Kind regards,

:heart:, osCommerce

Link to comment
Share on other sites

Hi Nick..

 

For PHP5.4 would it not also make sense to do this small change in the tep_session_is_registered function?

 

isset() returns false for null values (eg, $foo = null), which is why array_key_exists() is used.

 

Kind regards,

:heart:, osCommerce

Link to comment
Share on other sites

 

return isset($_SESSION[$variable]) && array_key_exists($variable, $_SESSION);

 

That is wrong anyway Nick

 

isset($_SESSION[$variable]) effectively can ( sort of ) do the same job as array_key_exists($variable, $_SESSION) so you duplicated code, but also as Harald mentioned it can have unwanted side effects.

 

Your code also didn't check whether $_SESSION is set so would trigger an error if it were not set.

 

If $_SESSION may not be set however ( PHP 4 <= 4.1.0 ) then you would also I suppose check if it were an array as well or the code could generate an error.

 

return isset($_SESSION) && is_array($_SESSION) && array_key_exists($variable, $_SESSION);

 

Re: isset() vs array_key_exists(), if I am checking if a variable is set I use isset() and if I am checking if an array key exists I would use array_key_exists() which is their correct usage, sometimes however with multi dimensional arrays array_key_exists can become unweildy which is why I think many get a bit too used to using isset().

Link to comment
Share on other sites

Just mentioned it because prior to the above linked fix at github, doing the small change mentioned made 2.3.1 run just fine on PHP5.4.

Link to comment
Share on other sites

Could we also get some old bug fixes included? Bug #134 has been around since 2010, and a working fix has been posted in the bug thread. This is a confirmed problem that prevents customers from logging in. There are many other open bugs that should be looked at and closed if possible.

 

Also, jQuery, jQuery UI, and the Redmond theme should be updated to the latest version. The obsolete version that ships with osCommerce currently causes problems when users try to create or download a new theme using the current version.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

If $_SESSION may not be set however ( PHP 4 <= 4.1.0 ) then you would also I suppose check if it were an array as well or the code could generate an error.

 

That wouldn't make sense as PHP < 4.1 doesn't have superglobals. In tep_session_is_registered(), $_SESSION is accessed as a superglobal if PHP >= 4.3 is used - it should be safe to assume it is an array.

:heart:, osCommerce

Link to comment
Share on other sites

Could we also get some old bug fixes included? .... Also, jQuery, jQuery UI, and the Redmond theme should be updated to the latest version.

 

All bug reports will be reviewed for v2.3.3. In addition, older libraries and modules will be updated.

:heart:, osCommerce

Link to comment
Share on other sites

@@Harald Ponce de Leon

 

Yup .. guess who wasn't in the function scope :)

Link to comment
Share on other sites

  • 2 months later...

I just came across a posting on the dutch forum which basically says that any special characters when used in PHP 5.4 together with ISO-8859-1 will cause the field to go blanc in the database because of the way htmlspecialchars treats illegal characters.

http://forums.oscommerce.nl/index.php?showtopic=26033&pid=155510&st=0entry155510

 

 

See http://nl.php.net/ma...ecialchars.php:

1. If omitted, the default value for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0, and UTF-8 from PHP 5.4.0 onwards.

2. If the input string contains an invalid code unit sequence within the given encoding an empty string will be returned, unless either the ENT_IGNORE or ENT_SUBSTITUTE flags are set.

 

This was an eyeopener for me as I still have my site in ISO-8859-1.

 

So my question is twofold:

1) how do I go from a MS2.2 installation to version 2.3.3 UTF-8, what are the proper steps ?

2) shouldn't htmlspecialchars provide the necessary flags based on the char-set defined ?

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

the actual character like "é"

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

  • 2 weeks later...

Hi All..

 

A PHP 5.4 compatibility fix will be included in v2.3.3 to make v2.3.x work under PHP 5.4 installations. The simple fix, which is not PHP 5.4 specific but rather a general bug fix, can be seen at:

 

https://github.com/osCommerce/oscommerce2/commit/9a4d1e6ab9ed87bdc20543995448b114364426b9

 

This should not have an affect on Add-Ons. If an Add-On is affected, it will be noted similar to what has been done for the v2.3.2 upgrade guide.

 

Kind regards,

 

Will this fix work with v.2.2 RC2 ?

#Joseph

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...