Upgrade ISC to PHP 7.3

Testing Procedure

You should monitor the console and all logs after the changes. You should test and go through each section, page, and button for both Desktop site, Mobile site, and Admin Area

  • Monitor Apache Error Log
  • Monitor PHP Error Log
  • Monitor ISC System Log
  • Monitor Browser DevTools Console

Desktop Site Test List

  • Homepage 
  • Category 
    • Sorting
    • Next/Previous
    • Fast Cart
  • Product 
    • Breadcrumb
    • Options
    • Add to Cart
    • Currency
    • Add to Wishlist
    • Tabs
  • Page 
  • Cart 
    • Add
    • Remove
    • Update Quantity
    • Shipping Quote
    • Checkout Button
  • Fast Cart
  • Checkout 
    • PayPal Express Checkout
    • Express Checkout
    • 2Checkout
    • Apply Coupon
  • Sitemap 
  • Quick Search 
  • Search 
    • Advanced Search
    • Search Tips
  • Newsletter 
  • My Account 
    • View Order Status
    • View Order Details
    • Reorder Selected
    • Completed Orders
    • Addressbook
    • Wish List
    • Account Details
    • Recent Items
  • Sign-In/Out 
  • Create Account 
  • 404 Page 
  • 301 Redirection 

Mobile Site Test List

  • Homepage
  • Category
  • Product
  • Cart
  • Checkout
  • Page
  • My Account

Admin Area Test List

  • Homepage
  • Add-On
  • Store Design
  • User Account
  • Tools
  • Settings
  • Orders
  • Customers
  • Products
  • Website Content
  • Marketing
  • Statistics

Compatibility

The code should be compatible with both PHP 5.6 and PHP 7.3

Limitation

There are many modules that I do not use, or they have been removed from my code, so you will probably see other errors.

But those errors should be similar and can be fixed by the same methods.

Disable PHP Strict Standards Error

At /lib/init.php

//error_reporting(E_ALL);
error_reporting(E_ALL ^ E_STRICT); 

MySQLi

Reference: https://thinkgenius.com/2018/01/24/interspire-shopping-cart-running-php-7-1-7-using-new-mysqli-php-class/

In /lib/init.php

require(ISC_BASE_PATH . '/lib/database/mysqli.php');

In /config/config.php

$GLOBALS['ISC_CFG']["dbType"] = 'mysqli';

PHP Error Fixing

Below are the list of PHP errors and warnings in PHP 7.3 and the solutions.

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; Db has a deprecated constructor in /public_html/lib/database/db.php on line 3

// https://stackoverflow.com/questions/36339774/php7-constructor-class-name

public function __construct()
{
    $this->magic_quotes_runtime_on = get_magic_quotes_runtime();
    return null;
}

function Db()
{
    $this->magic_quotes_runtime_on = get_magic_quotes_runtime();
    return null;
}

Methods with the same name as their class will not be constructors in a future version of PHP; MySQLDb has a deprecated constructor in /public_html/lib/database/mysqli.php on line 29

// https://stackoverflow.com/questions/36339774/php7-constructor-class-name

function __construct($hostname='', $username='', $password='', $databasename='')
{
$this->use_real_escape = version_compare(PHP_VERSION, '4.3.0', '>=');
$this->magic_quotes_runtime_on = get_magic_quotes_runtime();

if ($hostname && $username && $databasename) {
    $this->connection = $this->Connect($hostname, $username, $password, $databasename);
    return $this->connection;
}
return null;
}

function MySQLDb($hostname='', $username='', $password='', $databasename='')
{
$this->use_real_escape = version_compare(PHP_VERSION, '4.3.0', '>=');
$this->magic_quotes_runtime_on = get_magic_quotes_runtime();

if ($hostname && $username && $databasename) {
    $this->connection = $this->Connect($hostname, $username, $password, $databasename);
    return $this->connection;
}
return null;
}

Non-static generateRedirectUrl in /lib/class.redirects.php

 //public function generateRedirectUrl($urlPath)
 public static function generateRedirectUrl($urlPath)

mktime(): You should be using the time() function instead in /public_html/lib/general.php at 3578

//$result = call_user_func_array("mktime", $args);
$result = call_user_func_array("time", $args);

Unauthorized to access some admin sections

In /lib/general.php

function mysql_dump()
{
    //$mysql_ok = function_exists("mysql_connect");
    $a = spr1ntf(GetConfig('serverStamp'));
    //if (function_exists("mysql_select_db")) {
        return $a['edition'];
    //}
}

Non-static method TEMPLATE::GetInstance() should not be called statically in /public_html/lib/order.printing.php at 87

In /lib/templates/template.php

//public function GetInstance()
public static function GetInstance()

Non-static method Interspire_Template_Extension::jsFilter() should not be called statically, assuming $this from incompatible context

In /lib/Interspire/Template/Extension.php

//public function jsFilter($string) {
public static function jsFilter($string) {

Non-static method ISC_ADMIN_ORDERS::BuildOrderAddressDetails() should not be called statically in /public_html/lib/order.printing.php at 563

In /admin/includes/classes/class.orders.php

//public function BuildOrderAddressDetails($address, $includeFlag=true)
public static function BuildOrderAddressDetails($address, $includeFlag=true)

mysql_get_server_info(): A link to the server could not be established

In /admin/includes/classes/class.sysinfo.php

//$GLOBALS['MySQLVersion'] = isc_html_escape(mysql_get_server_info());
$link = mysqli_connect(GetConfig("dbServer"), GetConfig("dbUser"), GetConfig("dbPass"));
$GLOBALS['MySQLVersion'] = isc_html_escape(mysqli_get_server_info($link));

Only variables should be assigned by reference in /public_html/admin/includes/classes/class.customers.php at 433

//private function _GetGroupList(&$NumGroups)
private function &_GetGroupList(&$NumGroups)

Non-static method TEMPLATE::getTemplateConfiguration() should not be called statically in /public_html/admin/includes/classes/class.layout.php at 1081

//$phoneTemplateConfig = TEMPLATE::getTemplateConfiguration('__mobile');
$tpl = new TEMPLATE("");
$phoneTemplateConfig = $tpl->getTemplateConfiguration('__mobile');
$this->template->assign('phoneLogoDimensions', array(
	'width' => $phoneTemplateConfig['LogoWidth'],
	'height' => $phoneTemplateConfig['LogoHeight']
));

count(): Parameter must be an array or an object that implements Countable in /public_html/admin/includes/classes/class.news.php at 219

//if ($max > count($newsResult)) {
if (is_array($newsResult) && $max > count($newsResult)) {
	$max = count($newsResult);
}

count(): Parameter must be an array or an object that implements Countable in /public_html/admin/includes/classes/class.ebay.php at 1600

//if ($max > count($templateResult)) {
if (is_array($templateResult) && $max > count($templateResult)) {
	$max = count($templateResult);
}

count(): Parameter must be an array or an object that implements Countable in /public_html/admin/includes/classes/class.ebay.php at 2306

//if ($max > count($listingResult)) {
if (is_array($listingResult) && $max > count($listingResult)) {
	$max = count($listingResult);
}

count(): Parameter must be an array or an object that implements Countable in /public_html/admin/includes/classes/class.user.php at 258

//if($max > count($userResult)) {
if(is_array($userResult) && $max > count($userResult)) {
	$max = count($userResult);
}

count(): Parameter must be an array or an object that implements Countable in /public_html/admin/includes/classes/class.coupons.php

//if ($max > count($couponResult)) {
	if (is_array($couponResult) && $max > count($couponResult)) {
$max = count($couponResult);
}

count(): Parameter must be an array or an object that implements Countable in /public_html/admin/includes/classes/class.orders.php at 1084

//if ($max > count($orderResult)) {
if (is_array($orderResult) && $max > count($orderResult)) {
	$max = count($orderResult);
}

Declaration of ISC_ADMIN_EXPORTFILETYPE_ABANDONORDER::PostFieldLoad() should be compatible with ISC_ADMIN_EXPORTFILETYPE::PostFieldLoad($where = ”) in /public_html/admin/includes/exporter/filetypes/abandonorder.php at 0

Declaration of ISC_ADMIN_EXPORTFILETYPE_SALESTAX::PostFieldLoad() should be compatible with ISC_ADMIN_EXPORTFILETYPE::PostFieldLoad($where = ”) in /public_html/admin/includes/exporter/filetypes/salestax.php at 0

Declaration of ISC_ADMIN_EXPORTFILETYPE_ORDERS::PostFieldLoad() should be compatible with ISC_ADMIN_EXPORTFILETYPE::PostFieldLoad($where = ”) in public_html/admin/includes/exporter/filetypes/orders.php at 0

//protected function PostFieldLoad()
protected function PostFieldLoad($where = '')

The each() function is deprecated. This message will be suppressed on further calls in /public_html/includes/classes/class.checkout.php at 2385

//list(,$provider) = each($checkoutProviders);
$provider = current($checkoutProviders);

session_start(): Failed to read session data: user (path: /tmp) in /public_html/includes/classes/class.session.php at 53

//https://github.com/dominicklee/PHP-MySQL-Sessions/issues/1
//https://www.php.net/manual/en/function.session-start.php#120589
//https://stackoverflow.com/questions/48245296/php-custom-session-handler-problems-php-7-1?rq=1

//if(!empty($session)) {
//    return $session['sessdata'];
//} else {
//    $this->CreateSession();
//}
if(!empty($session)) {
    return $session['sessdata'];
} else {
    $this->CreateSession();
    return '';
}

Declaration of ISC_SHIPPING::SaveModuleSettings($settings = Array) should be compatible with ISC_MODULE::SaveModuleSettings($settings = Array, $deleteFirst = true) in /public_html/includes/classes/class.shipping.php on line 7

Declaration of SHIPPING_BYWEIGHT::SaveModuleSettings($settings = Array) should be compatible with ISC_SHIPPING::SaveModuleSettings($settings = Array, $deleteFirst = true) in /public_html/modules/shipping/byweight/module.byweight.php at 0

Declaration of SHIPPING_BYTOTAL::SaveModuleSettings($settings = Array) should be compatible with ISC_SHIPPING::SaveModuleSettings($settings = Array, $deleteFirst = true) in /public_html/modules/shipping/bytotal/module.bytotal.php at 0 

//public function SaveModuleSettings($settings=array())
public function SaveModuleSettings($settings=array(),$deleteFirst = true)

Declaration of ISC_LIVECHAT::GetPropertiesSheet($tabId) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.livechat.php at 0 

Declaration of ISC_COMMENTS::getPropertiesSheet($tabId) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.comments.php at 0 

Declaration of ISC_EMAILINTEGRATION::GetPropertiesSheet($tabId) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.emailintegration.php at 0

//public function getpropertiessheet($tabId)
public function getpropertiessheet($tabId, $idGlobal='', $jsGlobal='', $jsSelectedFunction='', $customVars = array(), $moduleId = null)

Declaration of ISC_CHECKOUT_PROVIDER::GetPropertiesSheet($tabId, $doHeaderRows = true, $moduleId = ”) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.checkoutprovider.php on line 0

//  public function GetPropertiesSheet($tabId, $doHeaderRows=true, $moduleId='')
public function GetPropertiesSheet($tabId, $idGlobal='', $jsGlobal='', $jsSelectedFunction='', $customVars = array(), $moduleId = NULL)
{
	$this->PreparePropertiesSheet($tabId, 'CheckoutId', 'CheckoutJavaScript', 'checkout_selected', array(), $moduleId);

	/*
	if (!$doHeaderRows) {
		$GLOBALS['HideHeaderRow'] = 'display:none;';
		$GLOBALS['HelpText'] = '';
	}
	*/

	if(!array_key_exists('doHeaderRows', $customVars) || $customVars['doHeaderRows'] == true) {
		$GLOBALS['HideHeaderRow'] = 'display:none;';
		$GLOBALS['HelpText'] = '';
	}

	return Interspire_Template::getInstance('admin')->render('module.propertysheet.tpl');
}

Bug in class.checkoutprovider.php

protected function getOrderTaxes()
{
	$orders = $this->GetOrders();
	if (empty($orders)) {
		return '';
	}

Declaration of ISC_ADDON::GetPropertiesSheet($tab_id) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.addon.php at 0

Declaration of ISC_ANALYTICS::GetPropertiesSheet($tab_id) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.analytics.php at 0 

Declaration of ISC_NOTIFICATION::GetPropertiesSheet($tab_id) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.notification.php on line 0 

Declaration of ISC_SHIPPING::getpropertiessheet($tab_id) should be compatible with ISC_MODULE::GetPropertiesSheet($tab_id, $idGlobal, $jsGlobal, $jsSelectedFunction, $customVars = Array, $moduleId = NULL) in /public_html/includes/classes/class.shipping.php on line 7

//public function getpropertiessheet($tab_id)
public function getpropertiessheet($tab_id, $idGlobal='', $jsGlobal='', $jsSelectedFunction='', $customVars = array(), $moduleId = null)

PHP Fatal error:  ‘continue’ not in the ‘loop’ or ‘switch’ context in /public_html/includes/classes/class.page.php on line 821

if (!is_array($page) || !array_key_exists("pageid", $page)) {
    //continue;
    return false;
}

PHP Fatal error:  Uncaught Error: Function name must be a string in /public_html/includes/classes/class.cart.php:68

//$this->$routes[$action]();
$this->{$routes[$action]}();

Non-static method ISC_CARTCONTENT_PANEL::GetProductFieldDetails() should not be called statically, assuming $this from incompatible context

In /includes/classes/display/CartContent.php

//public function GetProductFieldDetails($productFields, $cartItemId)
public static function GetProductFieldDetails($productFields, $cartItemId)

The each() function is deprecated. This message will be suppressed on further calls in /public_html/modules/checkout/2checkout/module.2checkout.php at 87

//list(,$order) = each($orders);
$order = current($orders); 

Declaration of RULE_FREESHIPPINGWHENOVERX::resetState(ISC_QUOTE $quote) should be compatible with ISC_RULE::resetState() in /public_html/modules/rule/freeshippingwhenoverx/module.freeshippingwhenoverx.php at 0

Declaration of RULE_XPERCENTOFFFORREPEATCUSTOMERS::resetState(ISC_QUOTE $quote) should be compatible with ISC_RULE::resetState() in /public_html/modules/rule/xpercentoffforrepeatcustomers/module.xpercentoffforrepeatcustomers.php at 0 

Declaration of RULE_XOFFFORREPEATCUSTOMERS::resetState(ISC_QUOTE $quote) should be compatible with ISC_RULE::resetState() in /public_html/modules/rule/xoffforrepeatcustomers/module.xoffforrepeatcustomers.php at 0 

Declaration of RULE_XAMOUNTOFFWHENXORMORE::resetState(ISC_QUOTE $quote) should be compatible with ISC_RULE::resetState() in /public_html/modules/rule/xamountoffwhenxormore/module.xamountoffwhenxormore.php at 3 

Declaration of RULE_BUYXGETFREESHIPPING::resetState(ISC_QUOTE $quote) should be compatible with ISC_RULE::resetState() in /public_html/modules/rule/buyxgetfreeshipping/module.buyxgetfreeshipping.php at 3 

Declaration of RULE_PERCENTOFFITEMSINCAT::resetState(ISC_QUOTE $quote) should be compatible with ISC_RULE::resetState() in /public_html/modules/rule/percentoffitemsincat/module.percentoffitemsincat.php at 0

//public function resetState(ISC_QUOTE $quote)
public function resetState(ISC_QUOTE $quote=null) 

Noticed that there’s a slew of typos in the “rule” section… Many of them have $GLOBAL[foo] calls that should be $GLOBALS[foo]. A quick search and replace in the modules/rule/ subdirectories of $GLOBAL[ for $GLOBALS[ should fix that.

if (isset($GLOBALS['var_orders'])) {
	$quantity = $GLOBALS['var_orders'];
}

Declaration of SHIPPING_BYWEIGHT::getpropertiessheet($tab_id) should be compatible with ISC_SHIPPING::GetPropertiesSheet($tab_id, $idGlobal = ”, $jsGlobal = ”, $jsSelectedFunction = ”, $customVars = Array, $moduleId = NULL) in /public_html/modules/shipping/byweight/module.byweight.php at 0 

Declaration of SHIPPING_BYTOTAL::getpropertiessheet($tab_id) should be compatible with ISC_SHIPPING::GetPropertiesSheet($tab_id, $idGlobal = ”, $jsGlobal = ”, $jsSelectedFunction = ”, $customVars = Array, $moduleId = NULL) in /public_html/modules/shipping/bytotal/module.bytotal.php at 0

//public function getpropertiessheet($tab_id)
public function getpropertiessheet($tab_id, $idGlobal='', $jsGlobal='', $jsSelectedFunction='', $customVars = array(), $moduleId = null)

Non-static method ISC_ADMIN_PRODUCT::FormatWYSIWYGHTML() should not be called statically in /public_html/admin/includes/classes/class.category.php at 491

In /admin/includes/classes/class.product.php

//public function FormatWYSIWYGHTML($HTML)
public static function FormatWYSIWYGHTML($HTML)

Undefined index: LAST_ORDER_DISCOUNTED_SUBTOTAL in /public_html/includes/classes/class.order.php at 177

//$discountedSubTotal = $_SESSION['LAST_ORDER_DISCOUNTED_SUBTOTAL'];
$discountedSubTotal = array_key_exists('LAST_ORDER_DISCOUNTED_SUBTOTAL', $_SESSION) ? $_SESSION['LAST_ORDER_DISCOUNTED_SUBTOTAL'] : $order[$subTotalColumn];

in_array() expects parameter 2 to be array, string given in /public_html/admin/includes/classes/class.orders.php at 1931

//if (isset($_REQUEST['preorders']) && !(in_array('0', $_REQUEST['preorders']) && in_array('1', $_REQUEST['preorders']))) {
if (isset($_REQUEST['preorders']) && is_array($_REQUEST['preorders']) &&  !(in_array('0', $_REQUEST['preorders']) && in_array('1', $_REQUEST['preorders']))) {

Resource is not really a resource in /public_html/lib/database/mysqli.php (Line 696)

https://bugs.php.net/bug.php?id=42797 : “MySQLi uses objects as storage contianer not resources, even when using the procedural API therefore the output is expected.”

if ($resource === null) {
	$this->SetError('Resource is a null object');
	return false;
}

//if (!is_resource($resource)) {
//	$this->SetError('Resource '.$resource.' is not really a resource');
//	return false;
//}

Undefined index: SHIPTOZIP in /modules/checkout/paypalexpress/module.paypalexpress.php at 462

//$stateID = $this->GetStateId($countryID, $nvpArray['SHIPTOSTATE']);
//$stateName = GetStateById($stateID);

if(isset($nvpArray['SHIPTOSTATE'])) {
	$stateID = $this->GetStateId($countryID, $nvpArray['SHIPTOSTATE']);
	$stateName = GetStateById($stateID);
}else{
	$stateID = '';
	$stateName = '';
}

if(!isset($nvpArray['SHIPTOZIP'])) {
	$nvpArray['SHIPTOZIP'] = 'NA';
}

2 Replies to “Upgrade ISC to PHP 7.3”

Leave a Reply

Your email address will not be published. Required fields are marked *