Update PHP error

  • Posts: 267
  • Thank you received: 5
6 years 1 month ago #298542

-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.8.12
-- PHP version -- : 7.1.22

Hello,

when I do the php update to version 7.2 and make a payment through the servired gateway. Give the following error:



"0 call to undefined function mcrypt_encrypt()

Thanks

Attachments:
Last edit: 6 years 1 month ago by dvddvd.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 1 month ago #298560

Hi,

Indeed, this function has been deprecated in PHP 7.2
The solution is to use openssl_encode instead which should normally be available.
Change the line:

$encryptkey = mcrypt_encrypt(MCRYPT_3DES, $decodekey, (string)$orderServired, MCRYPT_MODE_CBC, $iv);
to:
$message_padded = $orderServired;
		if (strlen($message_padded) % 8) {
		    $message_padded = str_pad($message_padded,
		        strlen($message_padded) + 8 - strlen($message_padded) % 8, "\0");
		}
		$encryptkey = openssl_encrypt($message_padded, "DES-EDE3-CBC", $decodekey, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $iv);
in the file plugins/hikashoppayment/servired/servired.php and that should fix the problem.
Please let us know how it works so that we can include the change on our end as we don't have the necessary information to test the servired payment plugin on our end.
Please also note that it requires PHP to support openSSL (it should be the case already for the vast majority of hostings):
php.net/manual/en/openssl.installation.php

The following user(s) said Thank You: dvddvd

Please Log in or Create an account to join the conversation.

  • Posts: 267
  • Thank you received: 5
6 years 1 month ago #298861

Thank you Nicilas,
works correctly!!!

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum