Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

osCommerce 2.33 php 5.5 compatability


stevebob

Recommended Posts

Posted

I just went through a transition from php 5.3 to 5.5 and ran into a very specific issue that I thought others should know about.  Once transitioned I had problems with Session Objects.  I would run into instances where the language globals weren't being set correctly.  These are set in application_top.php.

 

After digging into how oscommerce handles these, I discovered that it uses an assignment by reference to the $GLOBALS object when assigning these Session objects.  What I found out was, with simple data types (string, int, float, etc) this assignment by reference worked.  But, if you tried to assign, by reference, something like an array, it would fail.  For example, from login.php in the admin folder:

tep_session_register('admin');

$admin = array('id' => $check['id'],
             'username' => $check['user_name']);

prior to 5.5 this worked.

 

After 5.5 this does not work

 

to fix this I had to do the following:

tep_session_register('admin');

$_SESSION['admin']= array('id' => $check['id'],
             'username' => $check['user_name']);

this is tep_session_register function:

function tep_session_register($variable) {
if (PHP_VERSION < 4.3) {
return session_register($variable);
} else {
if (isset($GLOBALS[$variable])) {
    $_SESSION[$variable] =& $GLOBALS[$variable];
} else {
    $_SESSION[$variable] = null;
}
}

return false;
}
Posted

All this stuff was fixed in the later 2.3.3.x and 2.3.4 releases. Unless you have an overwhelming reason to stay at 2.3.3, such as a very heavily customized store, you would be much better off upgrading to 2.3.4 (or 2.3.4BS), which has PHP 5.6 capability built in.

Archived

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

×
×
  • Create New...