Skip to content

Commit

Permalink
MDI-1431 Fix WARNING: INI directive 'magic_quotes_sybase' is deprecat…
Browse files Browse the repository at this point in the history
…ed since PHP 5.3
  • Loading branch information
antoniorova authored and kpicaza committed Nov 26, 2021
1 parent 15119a2 commit 2020e20
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/adodb5/adodb.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2612,7 +2612,7 @@ function addq($s,$magic_quotes=false)
// undo magic quotes for "
$s = str_replace('\\"','"',$s);

if ($this->replaceQuote == "\\'" || ini_get('magic_quotes_sybase')) // ' already quoted, no need to change anything
if ($this->replaceQuote == "\\'") // ' already quoted, no need to change anything
return $s;
else {// change \' to '' for sybase/mssql
$s = str_replace('\\\\','\\',$s);
Expand Down Expand Up @@ -2646,7 +2646,7 @@ function qstr($s,$magic_quotes=false)
// undo magic quotes for "
$s = str_replace('\\"','"',$s);

if ($this->replaceQuote == "\\'" || ini_get('magic_quotes_sybase')) // ' already quoted, no need to change anything
if ($this->replaceQuote == "\\'") // ' already quoted, no need to change anything
return "'$s'";
else {// change \' to '' for sybase/mssql
$s = str_replace('\\\\','\\',$s);
Expand Down
21 changes: 8 additions & 13 deletions src/adodb5/drivers/adodb-mssql.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,13 @@ function qstr($s,$magic_quotes=false)
}

// undo magic quotes for " unless sybase is on
$sybase = ini_get('magic_quotes_sybase');
if (!$sybase) {
$s = str_replace('\\"','"',$s);
if ($this->replaceQuote == "\\'") // ' already quoted, no need to change anything
return "'$s'";
else {// change \' to '' for sybase/mssql
$s = str_replace('\\\\','\\',$s);
return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
}
} else {
return "'".$s."'";
}
$s = str_replace('\\"','"',$s);
if ($this->replaceQuote == "\\'") // ' already quoted, no need to change anything
return "'$s'";
else {// change \' to '' for sybase/mssql
$s = str_replace('\\\\','\\',$s);
return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
}
}
// moodle change end - see readme_moodle.txt

Expand Down Expand Up @@ -1096,4 +1091,4 @@ static function UnixTimeStamp($v)
http://www.databasejournal.com/scripts/article.php/1440551
*/

?>
?>
12 changes: 4 additions & 8 deletions src/adodb5/drivers/adodb-oci8.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1296,13 +1296,9 @@ function qstr($s,$magic_quotes=false)
}

// undo magic quotes for " unless sybase is on
if (!ini_get('magic_quotes_sybase')) {
$s = str_replace('\\"','"',$s);
$s = str_replace('\\\\','\\',$s);
return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
} else {
return "'".$s."'";
}
$s = str_replace('\\"','"',$s);
$s = str_replace('\\\\','\\',$s);
return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
}

}
Expand Down Expand Up @@ -1613,4 +1609,4 @@ function MoveNext()
return adodb_movenext($this);
}
}
?>
?>

0 comments on commit 2020e20

Please sign in to comment.