Make sure we have a DB connection before setting its charset
This commit is contained in:
parent
bde571728d
commit
e0fb15c185
|
@ -242,13 +242,16 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
if (common_config('db', 'type') == 'mysql' &&
|
if (common_config('db', 'type') == 'mysql' &&
|
||||||
common_config('db', 'utf8')) {
|
common_config('db', 'utf8')) {
|
||||||
$conn = $DB->connection;
|
$conn = $DB->connection;
|
||||||
if ($DB instanceof DB_mysqli) {
|
if (!empty($conn)) {
|
||||||
mysqli_set_charset($conn, 'utf8');
|
if ($DB instanceof DB_mysqli) {
|
||||||
} else if ($DB instanceof DB_mysql) {
|
mysqli_set_charset($conn, 'utf8');
|
||||||
mysql_set_charset('utf8', $conn);
|
} else if ($DB instanceof DB_mysql) {
|
||||||
|
mysql_set_charset('utf8', $conn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user