PHP 8 Compatibility Changes

This commit is contained in:
earnolmartin 2022-04-20 12:44:40 -06:00
parent 685109ec7e
commit 39eea135dc
5 changed files with 8 additions and 8 deletions

View file

@ -693,7 +693,7 @@ Committed_AS: 348732 kB
// magic quotes
if (isset($_GET['sql']) && get_magic_quotes_gpc()) {
if (isset($_GET['sql']) && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$_GET['sql'] = $_GET['sql'] = str_replace(array("\\'",'\"'),array("'",'"'),$_GET['sql']);
}
@ -999,7 +999,7 @@ Committed_AS: 348732 kB
function undomq($m)
{
if (get_magic_quotes_gpc()) {
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
// undo the damage
$m = str_replace('\\\\','\\',$m);
$m = str_replace('\"','"',$m);

View file

@ -834,7 +834,7 @@ if (!defined('_ADODB_LAYER')) {
* Requested by "Karsten Dambekalns" <k.dambekalns@fishfarm.de>
*/
function QMagic($s) {
return $this->qstr($s,get_magic_quotes_gpc());
return $this->qstr($s,function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
}
function q(&$s) {

View file

@ -54,7 +54,7 @@ function err($s)
// undo stupid magic quotes
function undomq(&$m)
{
if (get_magic_quotes_gpc()) {
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
// undo the damage
$m = str_replace('\\\\','\\',$m);
$m = str_replace('\"','"',$m);

View file

@ -2767,10 +2767,10 @@ function getVariable($variables,$dotrim=true) {
global ${$varname}; # make it global at same time.. may be disabled in future..
if($_POST[$varname]<>"") {
if(get_magic_quotes_gpc()) ${$varname}=stripslashes($_POST[$varname]);
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) ${$varname}=stripslashes($_POST[$varname]);
else ${$varname}=$_POST[$varname];
} else {
if(get_magic_quotes_gpc()) ${$varname}=stripslashes($_GET[$varname]);
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) ${$varname}=stripslashes($_GET[$varname]);
else ${$varname}=$_GET[$varname];
}

View file

@ -31,7 +31,7 @@ defined("NET2FTP") or die("Direct access to this location is not allowed.");
// 1 When a variable is submitted, quotes ' are replaced by backslash-quotes \'
// This function removes the extra backslash that is added
// -------------------------------------------------------------------------
if (get_magic_quotes_gpc() == 1) {
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() == 1) {
remove_magic_quotes($_POST);
remove_magic_quotes($_GET);
remove_magic_quotes($_COOKIE);
@ -405,7 +405,7 @@ function remove_magic_quotes(&$x, $keyname="") {
// http://www.php.net/manual/en/configuration.php#ini.magic-quotes-gpc (by the way: gpc = get post cookie)
// if (magic_quotes_gpc == 1), then PHP converts automatically " --> \", ' --> \'
// Has only to be done when getting info from get post cookie
if (get_magic_quotes_gpc() == 1) {
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() == 1) {
if (is_array($x)) {
foreach($x as $key => $value) {