Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

get_magic_qoutes_gpc Deprecated. #160

Open
Flinty916 opened this issue Mar 29, 2020 · 1 comment
Open

get_magic_qoutes_gpc Deprecated. #160

Flinty916 opened this issue Mar 29, 2020 · 1 comment

Comments

@Flinty916
Copy link

So I have the following code from the PayPalIPN php file. When running a test submit in sandbox mode, with error reporting on, I get an error. IPN block of code:

$get_magic_quotes_exists = false; if (function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exists = true; } foreach ($myPost as $key => $value) { if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { $value = urlencode(stripslashes($value)); } else { $value = urlencode($value); } $req .= "&$key=$value"; }

Error
Deprecated: Function get_magic_quotes_gpc() is deprecated

PHP version 7.4.0+ purely because that's when it got deprecated. Any suggestions?

@mickacz
Copy link

mickacz commented Apr 7, 2020

From PHP 5.4 get_magic_quotes_gpc() "Always returns FALSE because the magic quotes feature was removed from PHP."

edit this:

// Build the body of the verification post request, adding the _notify-validate command.
$req = 'cmd=_notify-validate';
$get_magic_quotes_exists = false;
if (function_exists('get_magic_quotes_gpc')) {
    $get_magic_quotes_exists = true;
}
foreach ($myPost as $key => $value) {
    if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
        $value = urlencode(stripslashes($value));
    } else {
        $value = urlencode($value);
    }
    $req .= "&$key=$value";
}

to this:

// Build the body of the verification post request, adding the _notify-validate command.
$req = 'cmd=_notify-validate';

foreach ($myPost as $key => $value) {
    $value = urlencode($value);
    $req .= "&$key=$value";
}

and everything will work in PHP 7.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants