Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

upgrade 2.2 to work with PHP 5.3 sessions?


drockaholla

Recommended Posts

Posted

I have a client running OSCommerce 2.2 (basically a CRELoaded 6.1 install), that has been incredibly customized for his business. There's literally no chance at a fresh install and reworking the store into it.

 

I have maintained the code over the years, and it's been functioning fine with PHP 5.1.6 after making all the necessary code changes. However, we have to upgrade to PHP 5.3.3 right away and I have been working through the depracated functions issues. I cleaed up all the depracted functions following the guide by Mark Evans on how to do so found here.

 

After following the Mark Evans tutorial, I could no longer sign in to my domain.com/catalog/admin folder. I rechecked all the changes incrementally and I've narrowed my problem down to this bit of code, from the catalog/admin/includes/functions/sessions.php file.

 

When I REPLACE THIS: (around line 70)

 

function tep_session_register($variable) {

return session_register($variable);

}

 

function tep_session_is_registered($variable) {

return session_is_registered($variable);

}

 

function tep_session_unregister($variable) {

return session_unregister($variable);

}

 

 

WITH THIS:

 

// check PHP version and use appropriate session variables - authored by ecartz (Matt)

 

function tep_session_register($variable) {

global $session_started;

 

if ($session_started == true) {

if (PHP_VERSION < 4.3) {

return session_register($variable);

} else {

if (isset($GLOBALS[$variable])) {

$_SESSION[$variable] =& $GLOBALS[$variable];

} else {

$_SESSION[$variable] = null;

}

}

}

 

return false;

}

 

function tep_session_is_registered($variable) {

if (PHP_VERSION < 4.3) {

return session_is_registered($variable);

} else {

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

}

}

 

function tep_session_unregister($variable) {

if (PHP_VERSION < 4.3) {

return session_unregister($variable);

} else {

unset($_SESSION[$variable]);

}

}

 

 

I can no longer log in at domain.com/catalog/admin, when I submit my administrator credentials, the page reloads empty, and I am stuck.

 

Any clues on how to get sessions working with OSC 2.2?

Posted

@@drockaholla

 

I suggest upgrading the installation to the latest version. CRE is not supported on this forum, so you will have to seek support from the CRE forum. Good Luck

 

 

 

Chris

Archived

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

×
×
  • Create New...