Jump to content

Archived

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

Pinball

Do PHP upgrades break osCommerce functionality?

Recommended Posts

Either I have it wrong or upgrading from PHP 5.3.28 to 5.4.0 breaks the session_is_registered that is scattered like buckshot throughout osCommerce.

 

As per PHP.net:

 

http://php.net/manual/en/function.session-is-registered.php

 

Warning

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

 

For example in checkout_shipping.php one runs into:

// register a random ID in the session to check throughout the checkout procedure
// against alterations in the shopping cart contents
  if (!tep_session_is_registered('cartID')) {
    tep_session_register('cartID');
  } elseif (($cartID != $cart->cartID) && tep_session_is_registered('shipping')) {
    tep_session_unregister('shipping');
  }

so, does REMOVED not mean that as of PHP 5.4.0 that !tep_session_is_registered no longer does anything?

 

Explanation appreciated!

 

Thanks.

Share this post


Link to post
Share on other sites

@@Pinball The tep_session_is_registered is an oscommerce function that calls the php session function. It is the latter that is deprecated. Your code needs to be updated to work with php 5.4. There will probably be other errors.

Share this post


Link to post
Share on other sites

Yes, I think I found the reference to this problem posted by Ponce a little while ago. It may be fixed in sessions.php:

 

http://library.oscommerce.com/Online&en&oscom_2_3&release_notes&v2_3_3#upg18

 

As originally discussed here:

 

http://forums.oscommerce.com/topic/393806-function-tep-session-register-in-php-54/

 

I'll read up on this further. My fork of osCommerce may be to far off to recover and thus if I come back to the original fold I want to be sure I am not wasting time on deprecated/obsolete calls

 

Thanks!

Share this post


Link to post
Share on other sites

Short answer: Yes. The guiding philosophy of PHP development is to obsolete (deprecate and remove) functionality which has been improved upon in some way in a later PHP release. The good side of this is that it forces sites using PHP code to stay up to date, and to not continue relying on inefficient or insecure constructs. The bad side of this is that code such as osCommerce, written to the latest and greatest PHP standards at the time, will break when PHP eventually obsoletes some things. You could write in a language which preserves everything dating back to punch card days, but then you end up with a bloated interpreter (or compiler), and you keep using inefficient or insecure things that you should have dropped long ago. But at least, you never have to update your code.Youse pays yer quarter and youse takes yer chances.

 

It sounds like you are running a very old version of osC. You can't expect it to be maintained forever, especially as old code doesn't work on current PHP releases. If you choose to keep it and keep extending it, as well as trying to patch it for more current PHP versions, eventually you will have created your own fork and will be solely responsible for maintaining it. You should seriously consider jumping to the latest and greatest osC (2.3.4BS), keeping careful track of your customizations, and staying up to date as new versions are released.

Share this post


Link to post
Share on other sites

×