Post by fluid » Fri Jun 15, 2018 4:47 pm

In the past 3 days i've encountered an issue with the checkout which seems to be related to the sagepay module we're using.

The checkout button no longer seems to respond, I thought this may be down to a CURL issue - i've updated CURL on the server but i'm none the wiser.

The error log shows as below

Code: Select all

2018-06-15 8:23:22 - PHP Notice:  Undefined variable: data in /var/www/vhosts/domain.com/httpdocs/catalog/model/payment/sagepay_direct_v3.php on line 150
Line 150 of the file is at the bottom of this code

Code: Select all

	public function sendCurl($url, $payment_data, $i = null) {
		$curl = curl_init($url);

		curl_setopt($curl, CURLOPT_PORT, 443);
		curl_setopt($curl, CURLOPT_HEADER, 0);
		curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
		curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
		curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
		curl_setopt($curl, CURLOPT_POST, 1);
		curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($payment_data));

		$response = curl_exec($curl);

		curl_close($curl);

		$response_info = explode(chr(10), $response);

		foreach ($response_info as $string) {
			if (strpos($string, '=') && isset($i)) {
				$parts = explode('=', $string, 2);
				$data['RepeatResponseData_' . $i][trim($parts[0])] = trim($parts[1]);
			} elseif (strpos($string, '=')) {
				$parts = explode('=', $string, 2);
				$data[trim($parts[0])] = trim($parts[1]);
			}
		}
		return $data;
	}
Any suggestions would be greatly appreciated as i'm at a loss of what to do and currently have a non working website.

I've not made any changes to server settings etc for quite some time so i'm not sure what's changed.

Newbie

Posts

Joined
Fri Jun 15, 2018 4:40 pm

Post by ADD Creative » Sun Jun 17, 2018 6:21 am

First check your server supports TLS 1.2 using PHP cRUL. Sage Pay did say the were enforcing this a few month ago, maybe they gave been late in doing so. This post may help to check. viewtopic.php?f=179&t=204260#p723228

CURLOPT_PORT, CURLOPT_FOLLOWLOCATION, CURLOPT_FORBID_REUSE and CURLOPT_FRESH_CONNECT are probably not needed. Try commenting them our temporally to see if anything changes.

Next thing to try would be to log or echo the $response to see if there are any error message.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by fluid » Mon Jun 18, 2018 7:30 pm

Thanks for the reply, i've updated Plesk and can confirm that the site only supports TLS 1.2

[root@s17768662 ~]# /usr/local/psa/bin/server_pref -s | grep ssl-protocols
ssl-protocols: TLSv1.2

An SSL Test also confirms this so i'm not sure that this is the issue.

The checkout button is still not working and the error log is still showing the below

2018-06-18 11:21:06 - PHP Notice: Undefined variable: data in /var/www/vhosts/domain.com/httpdocs/catalog/model/payment/sagepay_direct_v3.php on line 150

Newbie

Posts

Joined
Fri Jun 15, 2018 4:40 pm

Post by fluid » Mon Jun 18, 2018 7:45 pm

I've just re-read your post and i've done the test you've stated in the other post which results in "TLS 1.0" so it would appear you're correct.

I just need to work out how to enable TLS 1.2 using cURL, thanks for pointing me in the right direction.

Newbie

Posts

Joined
Fri Jun 15, 2018 4:40 pm

Post by ADD Creative » Mon Jun 18, 2018 10:23 pm

The version of OpenSSL used by PHP cURL functions needs to be version 1.0.1 or later. If you are on managed hosting, ask you host to sort it.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by fluid » Tue Jun 19, 2018 4:56 pm

The problem was I was using a very old version of cURL (7.19 from memory), when I ran the update it said I was on the latest version.

I had to add a new repository and update that way but it's now all back and working, thank you for your help!

Newbie

Posts

Joined
Fri Jun 15, 2018 4:40 pm
Who is online

Users browsing this forum: No registered users and 191 guests