Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Error after update of PHP from 7.2 to 8.1
Author « Topic »  

xyz1
Advanced Member

United Kingdom
179 Posts

Posted - 10/23/2026 :  05:05:28  
Currently running Ecommerce Plus PHP v7.9.6

As a result of this week's PHP vulnerabilities on Thursday afternoon we moved from PHP version 7.2 to version 8.1 (which includes the backported security fixes for the PHP vulnerabilities).

We use Cardsave as the payment provider and whilst payments are being received the thanks.php from the customppreturn.php file (which Vince configured for us some years ago) is showing the following error message (I've added the "zzzz"):

Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /home/zzzz/public_html/vsadmin/inc/customppreturn.php:4 Stack trace: #0 /home/zzzz/public_html/vsadmin/inc/incthanks.php(1919): include() #1 /home/zzzz/public_html/thanks.php(76): include('/home/zzzz...') #2 {main} thrown in /home/zzzz/public_html/vsadmin/inc/customppreturn.php on line 4

And the transaction status on the ECT dashboard does not get updated to "Authorized" with the relevant Transaction Auth Code and neither ourselves or the customer get the email Receipt with the order details.

Had a search on the forums and can see the following topic from 2020 relating to a Cardsave issue after changing from PHP5.6 to 7.2 although the error messages are not the exact same as we are seeing on the thanks.php page: https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=113445&SearchTerms=cardsave

Any ideas what needs changing in order to get things back on track again?

Many thanks,

Neil

Vince
Administrator

43529 Posts

Posted - 10/23/2026 :  06:42:17  
Hi Neil
The Magic Quotes functions were removed from PHP a while back and I think if you add an ampersand before the get_magic_quotes_gpc function in that file it should sort it out. For instance...

@get_magic_quotes_gpc

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

xyz1
Advanced Member

United Kingdom
179 Posts

Posted - 10/23/2026 :  08:37:22  
Hi Vince,

Many thanks for the reply.

Added the @ before the get_magic_quotes_gpc (as below) but it threw the same error message when doing another test card transaction:

******************************************

if (@get_magic_quotes_gpc()) {
$_POST = array_map('stripslashes', $_POST);
}

******************************************

Did a quick Google search which suggested that if running PHP 8.0 or newer, the get_magic_quotes_gpc() function has been completely removed from the PHP language and that placing an @ symbol in front of a function that does not exist will still result in a fatal "Uncaught Error: Call to undefined function get_magic_quotes_gpc()" and crash the script.

It then suggested that to stop the code being called on the more modern PHP versions (and prevent the crashes on PHP 8+) to either completely delete the lines of code or to check if the function exists first using the function_exists() statement.... I opted for trying the function_exists statement:

******************************************

if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$_POST = array_map('stripslashes', $_POST);
}

******************************************

Did another test card payment and the transaction went through correctly with the transaction status on the ECT dashboard being updated to "Authorized" with the relevant Transaction Auth Code and the order confirmation and email Receipt with the order details being sent correctly.

Just wanted to double check that you don't see any obvious issues or additional problems being created down the line with using the function_exists() statement in the customppreturn.php file ?

Thanks again.

Neil

Vince
Administrator

43529 Posts

Posted - 10/23/2026 :  10:30:16  
Hi Neil
Good point and I thought that would be a quick way to solve this. But really, as the function will not exist then all this can just be removed...

if (@get_magic_quotes_gpc()) {
$_POST = array_map('stripslashes', $_POST);
}

But as you have it is fine too I think.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0 seconds. Snitz Forums 2000