RazerMS / Shopping-Cart-Plugins-RazerMS_WHMCS

Razer Merchant Services WHMCS Shopping Cart Plugin
https://merchant.razer.com/v3/
0 stars 4 forks source link

Callback handler uses deprecated each() function incompatible with PHP 8+ #9

Closed LowKey88 closed 1 year ago

LowKey88 commented 1 year ago

Description:

The callback handler for the MOLPay (Razer Merchant Services) gateway module uses the deprecated each() function, which has been removed in PHP 8.0 and later. This causes the script to fail when executed in environments using PHP 8 and above.

File & Line Number:

Steps to Reproduce:

  1. Set up a server environment using PHP 8.0 or later.
  2. Execute a transaction using the MOLPay gateway.
  3. Observe the error: Call to undefined function each() when the callback is triggered.

Expected Behavior:

The callback script should process the transaction data without any errors.

Actual Behavior:

Received a fatal error indicating the each() function is undefined.

Suggested Fix:

Replace the usage of each() with a suitable alternative, such as a foreach loop.


foreach ($_POST as $k => $v) 
{
    $postData[] = $k . "=" . $v;
}
Kheechieng commented 1 year ago

image

The user feedback that the suggested fix is working, and also having concern about many of the existing function in this plugin has been deprecated in PHP 8.x

wankimmy commented 1 year ago

Updated the plugin https://github.com/RazerMS/Shopping-Cart-Plugins-RazerMS_WHMCS/commit/73de616acb377b036c109a8c853a5c9862fc35a7