Jump to content

SagePay (Form)


CubeCart Bot
 Share

Recommended Posts

  • 3 months later...

  • 4 years later...

There is mention of a backward incompatibility with PHP8 vs PHP7: "Attempting to read a property of a non-object." We can assume similar incompatibilities with respect to writing, as well as using the 'property accessor' operator to work with arrays.

So, the following edits is an experiment that uses array index syntax:

In the SagePay module, gateway.class.php file:

Near lines 119 and 120, find:
$resultArray[$i]->start = $start;
$resultArray[$i]->token = $Tokens[$i];

Change to:
$resultArray[$i]['start'] = $start;
$resultArray[$i]['token'] = $Tokens[$i];

Near line 129, find:
$valueStart = $resultArray[$i]->start + strlen($resultArray[$i]->token) + 1;

Change to:
$valueStart = $resultArray[$i]['start'] + strlen($resultArray[$i]['token']) + 1;

Near line 132, find:
$output[$resultArray[$i]->token] = substr($thisString, $valueStart);

Change to:
$output[$resultArray[$i]['token']] = substr($thisString, $valueStart);

Near lines 134 and 135, find:
$valueLength = $resultArray[$i+1]->start - $resultArray[$i]->start - strlen($resultArray[$i]->token) - 2;
$output[$resultArray[$i]->token] = substr($thisString, $valueStart, $valueLength);

Change to:
$valueLength = $resultArray[$i+1]['start'] - $resultArray[$i]['start'] - strlen($resultArray[$i]['token']) - 2;
$output[$resultArray[$i]['token']] = substr($thisString, $valueStart, $valueLength);

 

Edited by bsmither
Link to comment
Share on other sites

21 minutes ago, bsmither said:

There is mention of a backward incompatibility with PHP8 vs PHP7: "Attempting to read a property of a non-object." We can assume similar incompatibilities with respect to writing, as well as using the 'array accessor' operator to work with arrays.

So, the following edits is an experiment that uses array index syntax:

In the SagePay module, gateway.class.php file:

Near lines 119 and 120, find:
$resultArray[$i]->start = $start;
$resultArray[$i]->token = $Tokens[$i];

Change to:
$resultArray[$i]['start'] = $start;
$resultArray[$i]['token'] = $Tokens[$i];

Near line 129, find:
$valueStart = $resultArray[$i]->start + strlen($resultArray[$i]->token) + 1;

Change to:
$valueStart = $resultArray[$i]['start'] + strlen($resultArray[$i]['token']) + 1;

Near line 132, find:
$output[$resultArray[$i]->token] = substr($thisString, $valueStart);

Change to:
$output[$resultArray[$i]['token']] = substr($thisString, $valueStart);

Near lines 134 and 135, find:
$valueLength = $resultArray[$i+1]->start - $resultArray[$i]->start - strlen($resultArray[$i]->token) - 2;
$output[$resultArray[$i]->token] = substr($thisString, $valueStart, $valueLength);

Change to:
$valueLength = $resultArray[$i+1]['start'] - $resultArray[$i]['start'] - strlen($resultArray[$i]['token']) - 2;
$output[$resultArray[$i]['token']] = substr($thisString, $valueStart, $valueLength);

 

Thanks a lot, I've just run those changes and it works as a charm !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...