MDL-23610 finally fixed the broken utf8 detection in mysqli driver
this was actually causing tons of false reports because people are often creating the database without the encoding parameter, especially when testing upgrades
This commit is contained in:
@@ -572,11 +572,38 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||
$result = $this->mysqli->query($sql);
|
||||
$this->query_end($result);
|
||||
|
||||
$return = false;
|
||||
if ($result) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
if (isset($row['Value'])) {
|
||||
$return = (strtoupper($row['Value']) === 'UTF8' or strtoupper($row['Value']) === 'UTF-8');
|
||||
}
|
||||
break;
|
||||
}
|
||||
$result->close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
if (!$return) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = "SHOW LOCAL VARIABLES LIKE 'collation_database'";
|
||||
$this->query_start($sql, null, SQL_QUERY_AUX);
|
||||
$result = $this->mysqli->query($sql);
|
||||
$this->query_end($result);
|
||||
|
||||
$return = false;
|
||||
if ($result) {
|
||||
while($row = $result->fetch_assoc()) {
|
||||
if (isset($row['Value'])) {
|
||||
$return = (strpos($row['Value'], 'latin1') !== 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
$result->close();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user