Replies: 0
My Visual Studio Code is telling me that there is mis-use of a $this variable, starting at line 352 in file class.db.php, under the installer/dup-installer/classes directory. This is the code:
public static function setCharset($dbh, $charset = null, $collate = null)
{
$charset = (!isset($charset) ) ? $GLOBALS['DBCHARSET_DEFAULT'] : $charset;
$collate = (!isset($collate) ) ? $GLOBALS['DBCOLLATE_DEFAULT'] : $collate;
if (self::hasAbility($dbh, 'collation') && !empty($charset)) {
if (function_exists('mysqli_set_charset') && self::hasAbility($dbh, 'set_charset')) {
return mysqli_set_charset($dbh, $charset);
} else {
$sql = " SET NAMES ".mysqli_real_escape_string($this->dbh, $charset);
if (!empty($collate)) $sql .= " COLLATE ".mysqli_real_escape_string($this->dbh, $collate);
return mysqli_query($dbh, $sql);
}
}
}
The specific error message is:
$this cannot be used in static methods
I’m using the latest version of Duplicator in WordPress 5.0